-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Motivation: For direct replication (#27) we need to send CRDTs to remote replicators, therefore they need to be serializable. Modifications: - Define protobufs for CRDTs and conform to `InternalProtobufRepresentable`. - Define protobufs for `CRDT.Replicator.RemoteCommand`. - Special handling in `Serialization` for CRDT serializers. Result: Be able to send `CRDT.Replicator.RemoteCommand` message to remote replicators.
- Loading branch information
Showing
19 changed files
with
2,036 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift Distributed Actors open source project | ||
// | ||
// Copyright (c) 2019 Apple Inc. and the Swift Distributed Actors project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.md for the list of Swift Distributed Actors project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
syntax = "proto3"; | ||
|
||
option optimize_for = SPEED; | ||
option swift_prefix = "Proto"; | ||
|
||
import "ActorAddress.proto"; | ||
|
||
// TODO: consider making this file or part of it public since it contains proto types that can be used for custom CRDTs | ||
|
||
// ===== CRDT.Identity ===== | ||
|
||
message CRDTIdentity { | ||
string id = 1; | ||
} | ||
|
||
// ===== CRDT.ReplicaId ===== | ||
|
||
message CRDTReplicaId { | ||
oneof value { | ||
CRDTReplicaId_ActorAddress actorAddress = 1; | ||
} | ||
} | ||
|
||
message CRDTReplicaId_ActorAddress { | ||
ActorAddress actorAddress = 1; | ||
} | ||
|
||
// ===== CRDT.GCounter ===== | ||
|
||
message CRDTGCounter { | ||
message ReplicaState { | ||
CRDTReplicaId replicaId = 1; | ||
uint64 count = 2; | ||
} | ||
|
||
message Delta { | ||
repeated ReplicaState state = 1; | ||
} | ||
|
||
CRDTReplicaId replicaId = 1; | ||
// Not a map because only integral or string type can be keys | ||
repeated ReplicaState state = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift Distributed Actors open source project | ||
// | ||
// Copyright (c) 2019 Apple Inc. and the Swift Distributed Actors project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.md for the list of Swift Distributed Actors project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
syntax = "proto3"; | ||
|
||
option optimize_for = SPEED; | ||
option swift_prefix = "Proto"; | ||
|
||
message AnyCvRDT { | ||
uint32 underlyingSerializerId = 1; | ||
bytes underlyingBytes = 2; | ||
} | ||
|
||
message AnyDeltaCRDT { | ||
uint32 underlyingSerializerId = 1; | ||
bytes underlyingBytes = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift Distributed Actors open source project | ||
// | ||
// Copyright (c) 2019 Apple Inc. and the Swift Distributed Actors project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.md for the list of Swift Distributed Actors project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
syntax = "proto3"; | ||
|
||
option optimize_for = SPEED; | ||
option swift_prefix = "Proto"; | ||
|
||
import "ActorAddress.proto"; | ||
import "CRDT/CRDT.proto"; | ||
import "CRDT/CRDTAny.proto"; | ||
|
||
// ===== CRDT.Replicator.Message ===== | ||
|
||
message CRDTReplicatorMessage { | ||
oneof value { | ||
CRDTWrite write = 1; | ||
} | ||
} | ||
|
||
// ===== CRDT.Replicator.RemoteCommand.write ===== | ||
|
||
message CRDTWrite { | ||
CRDTIdentity identity = 1; | ||
ReplicatedData data = 2; | ||
ActorAddress replyTo = 3; | ||
} | ||
|
||
message CRDTWriteResult { | ||
enum Type { | ||
SUCCESS = 0; | ||
FAILED = 1; | ||
} | ||
|
||
Type type = 1; | ||
CRDTWriteError error = 2; | ||
} | ||
|
||
message CRDTWriteError { | ||
enum Type { | ||
MISSING_CRDT_FOR_DELTA = 0; | ||
INCORRECT_DELTA_TYPE = 1; | ||
CANNOT_WRITE_DELTA_FOR_NON_DELTA_CRDT = 2; | ||
INPUT_AND_STORED_DATA_TYPE_MISMATCH = 3; | ||
UNSUPPORTED_CRDT = 4; | ||
} | ||
|
||
Type type = 1; | ||
} | ||
|
||
// ===== Common ===== | ||
|
||
message ReplicatedData { | ||
oneof payload { | ||
AnyCvRDT cvrdt = 1; | ||
AnyDeltaCRDT deltaCrdt = 2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.