crdt_grpc_sync
library
Functions
listen (Crdt crdt , int port , {CrdtSyncServiceConfig config = const CrdtSyncServiceConfig() })
→ Future <CrdtSyncServer >
Start a gRPC server that accepts CrdtSync connections.
crdt is the local CRDT instance to sync with peers.
port is the listening port (0 = OS-assigned).
Typedefs
ChangesetBuilder
= FutureOr <CrdtChangeset > Function({String ? exceptNodeId , Hlc? modifiedAfter , Hlc? modifiedOn , String ? onlyNodeId , Iterable <String > ? onlyTables })
Builds a changeset for sync. Customize to filter, transform, or encrypt.
ChangesetMapper
= CrdtRecord Function(String table , CrdtRecord record )
Transforms records before encode (outgoing) or after decode (incoming).
ClientHandshakeDataBuilder
= FutureOr <Object > ? Function()
Builds custom metadata sent in the client handshake.
OnChangesetEvent
= void Function(String nodeId , Map <String , int > recordCounts )
Reports sent or received changeset with record counts per table.
OnClientConnected
= void Function(CrdtSync crdtSync , Object ? customData )
Called on successful client init, customData is from handshake callback
OnClientConnecting
= void Function(ServiceCall call )
Called when a new gRPC handshake request arrives.
OnConnected
= void Function(String peerId , Object ? customData )
Called when handshake completes successfully.
OnDisconnected
= void Function(String peerId , int code , String reason )
Called when connection with peer is lost.
RecordValidator
= FutureOr <bool > Function(String table , CrdtRecord record )
Validates incoming records before merge. Return false to reject.
ServerHandshakeDataBuilder
= FutureOr <Object > ? Function(String peerId , Object ? peerData )
Builds custom metadata sent in the server handshake response.