Skip to content

Commit

Permalink
Merge pull request #49 from brave/update_C85
Browse files Browse the repository at this point in the history
Update protobuf files to Chromium 85.0.4183.83
  • Loading branch information
yrliou authored Sep 2, 2020
2 parents e068b66 + b53cd74 commit 660ab62
Show file tree
Hide file tree
Showing 21 changed files with 1,949 additions and 1,007 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A sync server implemented in go to communicate with Brave sync clients using
[components/sync/protocol/sync.proto](https://cs.chromium.org/chromium/src/components/sync/protocol/sync.proto).
Current Chromium version for sync protocol buffer files used in this repo is Chromium 83.0.4103.61.
Current Chromium version for sync protocol buffer files used in this repo is Chromium 85.0.4183.83.

This server supports endpoints as bellow.
- The `POST /v2/command/` endpoint handles Commit and GetUpdates requests from sync clients and return corresponding responses both in protobuf format. Detailed of requests and their corresponding responses are defined in `schema/protobuf/sync_pb/sync.proto`. Sync clients are responsible for generating valid access tokens and present them to the server in the Authorization header of requests.
Expand Down
6 changes: 0 additions & 6 deletions datastore/sync_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type SyncEntity struct {
ClientID string
ID string
ParentID *string `dynamodbav:",omitempty"`
OldParentID *string `dynamodbav:",omitempty"`
Version *int64
Mtime *int64
Ctime *int64
Expand Down Expand Up @@ -281,9 +280,6 @@ func (dynamo *Dynamo) UpdateSyncEntity(entity *SyncEntity) (bool, bool, error) {
if entity.ParentID != nil {
update = update.Set(expression.Name("ParentID"), expression.Value(entity.ParentID))
}
if entity.OldParentID != nil {
update = update.Set(expression.Name("OldParentID"), expression.Value(entity.OldParentID))
}
if entity.Name != nil {
update = update.Set(expression.Name("Name"), expression.Value(entity.Name))
}
Expand Down Expand Up @@ -570,7 +566,6 @@ func CreateDBSyncEntity(entity *sync_pb.SyncEntity, cacheGUID *string, clientID
ClientID: clientID,
ID: id,
ParentID: entity.ParentIdString,
OldParentID: entity.OldParentId,
Version: entity.Version,
Ctime: cTime,
Mtime: now,
Expand All @@ -594,7 +589,6 @@ func CreatePBSyncEntity(entity *SyncEntity) (*sync_pb.SyncEntity, error) {
pbEntity := &sync_pb.SyncEntity{
IdString: &entity.ID,
ParentIdString: entity.ParentID,
OldParentId: entity.OldParentID,
Version: entity.Version,
Mtime: entity.Mtime,
Ctime: entity.Ctime,
Expand Down
5 changes: 0 additions & 5 deletions datastore/sync_entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ func (suite *SyncEntityTestSuite) TestUpdateSyncEntity_Basic() {
updateEntity2.Folder = aws.Bool(false)
updateEntity2.UniquePosition = []byte{5, 6}
updateEntity2.ParentID = aws.String("parentID")
updateEntity2.OldParentID = aws.String("oldParentID")
updateEntity2.Name = aws.String("name")
updateEntity2.NonUniqueName = aws.String("non_unique_name")
conflict, delete, err = suite.dynamo.UpdateSyncEntity(&updateEntity2)
Expand Down Expand Up @@ -525,7 +524,6 @@ func (suite *SyncEntityTestSuite) TestCreateDBSyncEntity() {
pbEntity := sync_pb.SyncEntity{
IdString: aws.String("client_item_id"),
ParentIdString: aws.String("parent_id"),
OldParentId: aws.String("old_parent_id"),
Version: aws.Int64(0),
Name: aws.String("name"),
NonUniqueName: aws.String("non_unique_name"),
Expand All @@ -539,7 +537,6 @@ func (suite *SyncEntityTestSuite) TestCreateDBSyncEntity() {
expectedDBEntity := datastore.SyncEntity{
ClientID: "client1",
ParentID: pbEntity.ParentIdString,
OldParentID: pbEntity.OldParentId,
Version: pbEntity.Version,
Name: pbEntity.Name,
NonUniqueName: pbEntity.NonUniqueName,
Expand Down Expand Up @@ -637,7 +634,6 @@ func (suite *SyncEntityTestSuite) TestCreatePBSyncEntity() {
ClientID: "client1",
ID: "id1",
ParentID: aws.String("parent_id"),
OldParentID: aws.String("old_parent_id"),
Version: aws.Int64(10),
Mtime: aws.Int64(12345678),
Ctime: aws.Int64(12345678),
Expand All @@ -657,7 +653,6 @@ func (suite *SyncEntityTestSuite) TestCreatePBSyncEntity() {
expectedPBEntity := sync_pb.SyncEntity{
IdString: &dbEntity.ID,
ParentIdString: dbEntity.ParentID,
OldParentId: dbEntity.OldParentID,
Version: dbEntity.Version,
Mtime: dbEntity.Mtime,
Ctime: dbEntity.Ctime,
Expand Down
218 changes: 150 additions & 68 deletions schema/protobuf/sync_pb/device_info_specifics.pb.go

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions schema/protobuf/sync_pb/device_info_specifics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ message DeviceInfoSpecifics {
// excludes backgrounded apps on Android). Introduced in M81. The legacy
// default was 1 day.
optional int32 pulse_interval_in_minutes = 13;

// Device specific information for Sync invalidations.
optional InvalidationSpecificFields invalidation_fields = 14;
}

// Feature specific information about the device that is running a sync-enabled
Expand Down Expand Up @@ -137,3 +140,11 @@ message SharingSpecificFields {
// Auth secret for message encryption [RFC8291] using Sharing sender ID.
optional bytes sender_id_auth_secret_v2 = 10;
}

// Device specific information telling how to send invalidations to this device.
message InvalidationSpecificFields {
// FCM registration token of device (using Sync sender ID).
optional string instance_id_token = 1;

// TODO(crbug.com/1082117): add data types list.
}
23 changes: 19 additions & 4 deletions schema/protobuf/sync_pb/entity_metadata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions schema/protobuf/sync_pb/entity_metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ message EntityMetadata {
// unique_position.proto for more information about its internal
// representation.
optional UniquePosition unique_position = 11;

// Used only for bookmarks. It's analogous to |specifics_hash| but it
// exclusively hashes the content of the favicon image, as represented in
// proto field BookmarkSpecifics.favicon, using base::PersistentHash().
optional fixed32 bookmark_favicon_hash = 12;
}
59 changes: 36 additions & 23 deletions schema/protobuf/sync_pb/sharing_message_specifics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions schema/protobuf/sync_pb/sharing_message_specifics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,15 @@ message SharingMessageCommitError {
// Client-specific error codes.
SYNC_TURNED_OFF = 8;
SYNC_NETWORK_ERROR = 9;
// Error code for server error or unparsable server response.
SYNC_SERVER_ERROR = 10;
// Deprecated UMA bucket, prior to splitting between SYNC_SERVER_ERROR and
// SYNC_AUTH_ERROR.
DEPRECATED_SYNC_SERVER_OR_AUTH_ERROR = 10;
// Message wasn't committed before timeout.
SYNC_TIMEOUT = 11;
// Error code for server error or unparsable server response.
SYNC_SERVER_ERROR = 12;
// Auth error when communicating with the server.
SYNC_AUTH_ERROR = 13;
}

optional ErrorCode error_code = 1;
Expand Down
Loading

0 comments on commit 660ab62

Please sign in to comment.