SyncAPI

Top

The Sync API allows clients to collaboratively read and write JSON data to a shared resource.

CreateSynapseConnection()

Create a synapse connection resource.

A synapse connection defines a bi-directional syncronisation between two Volt databases. The connection is created as a child of the local synapse resource, and a symbolic link is also placed in the system-wide 'connection' folder.

The remote Volt is identified by its DID or address. If a relay address is provided, the connection will be established via the relay.

The authenticated account must have `volt:resource-create` access to the local synapse resource.

Request: SaveResourceRequest
Response: SaveResourceResponse

SetSynapseDocumentMetadata()

Set the metadata for a synapse document.

Request: SetSynapseDocumentMetadataRequest
Response: SetSynapseDocumentMetadataResponse

SyncDocument()

Bidirectional streaming RPC for real-time document synchronization

Request: streaming SyncDocumentRequest
Response: streaming SyncDocumentResponse

WatchSynapsePath()

Watch synapse paths for changes.

Request: streaming WatchSynapsePathRequest
Response: streaming WatchSynapsePathResponse

WriteSynapsePath()

Write a single value to a given synapse JSON path.

Request: WriteSynapsePathRequest
Response: WriteSynapsePathResponse

SetSynapseDocumentMetadataRequest

FieldTypeDescription
database_idstring

The id of the synapse.

document_idstring

The id of the document to set the metadata for.

metadataSynapseDocumentMetadata repeated

The metadata to set for the document.

jsonstring

Any additional application-specific JSON to attach to the document.

SetSynapseDocumentMetadataResponse

FieldTypeDescription
statusStatus

SynapseDocumentMetadata

FieldTypeDescription
namestring

The name of the top-level shared type in the document.

typestring

The type of the shared type, e.g. "map", "array" or "text".

json_schemastring

The JSON schema that describes the data that is stored in this shared type.

SyncDocumentRequest

FieldTypeDescription
sync_startSyncDocumentStart

Initial sync configuration, must be sent as first message.

updateSyncDocumentUpdate

Updates to apply to the remote document.

sync_stateSyncState

The sync state of the local document

SyncDocumentResponse

FieldTypeDescription
statusStatus

Details of any error that occurred on the call.

state_vectorbytes

The state vector of the Volt (remote) document. Only present in the initial response.

updateSyncDocumentUpdate

Updates to apply to client (local) document.

sync_stateSyncState

The sync state of the Volt (remote) document

is_read_onlybool

Set to true if the client is in read-only mode. Only present in the initial response.

SyncDocumentStart

FieldTypeDescription
database_idstring

The id of the database that contains the document.

document_idstring

The id of the document to sync.

state_vectorbytes

The clients state vector. The Volt will respond with updates that should be applied to the local document.

read_onlybool

Set to true to only receive updates from other clients.

read_only_fallbackbool

Set to true to downgrade to read-only access if the client does not have write access.

SyncDocumentUpdate

FieldTypeDescription
chunkbytes

completebool

WatchSynapsePathRequest

FieldTypeDescription
startWatchSynapsePathStart

Start watching the given paths; must be sent as the first message.

stopbool

Request to stop the watch.

WatchSynapsePathResponse

FieldTypeDescription
statusStatus

Details of any error that occurred on the call.

updateWatchSynapsePathUpdate

The update to the path.

WatchSynapsePathStart

Parameters to start watching synapse paths. Sent as the first message.

FieldTypeDescription
database_idstring

The id of the database that contains the document.

document_idstring

The id of the document to watch.

pathstring repeated

The JSON paths to watch.

WatchSynapsePathUpdate

FieldTypeDescription
watch_pathstring

The JSON path that was updated.

event_pathstring

The actual JSON path for this match (e.g. $.content["Atlantic Star"].lat).

Enables clients to identify which array element or map key the update refers to when using wildcard matches such as $.content[*]

update_typeSynapsePathUpdateType

The type of update.

valuestring

The JSON value that was updated.

previous_valuestring

The previous JSON value before the update.

indexuint32

The zero-based index of the update.

totaluint32

The total number of updates.

WriteSynapsePathRequest

FieldTypeDescription
database_idstring

The id of the database that contains the document.

document_idstring

The id of the document to write to.

pathstring

The JSON path to write to.

jsonstring

The JSON value to write.

WriteSynapsePathResponse

FieldTypeDescription
statusStatus

Details of any error that occurred on the call.

SynapsePathUpdateType

NameNumberDescription
SYNAPSE_PATH_UPDATE_TYPE_UNKNOWN0

SYNAPSE_PATH_UPDATE_TYPE_ADD1

SYNAPSE_PATH_UPDATE_TYPE_UPDATE2

SYNAPSE_PATH_UPDATE_TYPE_DELETE3

SyncState

NameNumberDescription
SYNC_STATE_UNKNOWN0

SYNC_STATE_SYNCING1

SYNC_STATE_DONE2

SYNC_STATE_UPDATE3

SYNC_STATE_AWARENESS4

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)