ChangeStreamService
CE Change Data Capture: the committed changes of a shard as logical events, streamed from its Raft log via gRPC server-side streaming.
Each committed transaction is a unit; each of its effects is an event: a put, patch or removal of a node, a relationship's presence, its properties, or one version or discriminated instance of it. The client keeps an opaque cursor and reconnects with it to continue where it chose. At-least-once delivery. History is released only up to a cursor the client acknowledges with AcknowledgeSubscription.
Proto source
Methods
Subscribe
Open a long-lived server-side streaming RPC that tails the Raft log.
The server streams ChangeBatch messages, each with whole units, once the serving node has applied their log entries; entries that are not committed yet are never sent. Every unit the stream passes is in a batch, one with no event the interest takes too. When caught up, the stream waits until the node applies another entry. The stream stays open until the client cancels or the connection drops.
On reconnect, pass the cursor of the last batch received to resume without gaps. Omit it to start where the registration stands: its acknowledged position, or the oldest retained entry for a new one. A cursor binds the history, the event interpretation and the interest it was read with: one of another history or interpretation, or read with another interest than the request's, is refused with INVALID_ARGUMENT.
Every stream reads as a registered consumer: the request names the consumer and either registers it with an explicit retention policy (incarnation 0) or resumes a live registration (incarnation from the first stream). The registration outlives the connection until CancelSubscription. The response's initial metadata carries the registration's incarnation as x-coordinode-consumer-incarnation.
A position the log no longer holds is refused with FAILED_PRECONDITION and ErrorInfo reason RETENTION_LOST (metadata requested_index, first_retained_index): the stream never resumes past a gap, and never jumps to the newest entry in its place. An ORDINARY consumer that gets it rebuilds its state and acknowledges a position the log holds. A registration that has ended is refused with FAILED_PRECONDITION and reason CONSUMER_TERMINATED (metadata incarnation, reason, checkpoint); registering the id again starts a new incarnation.
A unit the stream cannot project (a change recorded without the context that says what it means) fails the stream with FAILED_PRECONDITION and ErrorInfo reason CHANGE_FEED_UNSUPPORTED; the stream does not pass it.
Sending a batch is not delivery: a stream resumed without a cursor starts at the acknowledged position and re-sends what the client never acknowledged, while the log still holds it. A cursor chooses where reading starts and releases nothing.
Transport: Server-streaming gRPC only (no HTTP transcoding)
Request: SubscribeRequest
| Field | Type | Description |
|---|---|---|
cursor | bytes | The cursor of the last batch received. Omit to start where the registration stands. |
interest | ChangeInterest | What the subscription follows; with a cursor, the interest it was read with, by the names its labels were created under. A cursor keeps the labels it was read with: when one of them was dropped and its name created again, the stream still reads the dropped label, its DROP included, and not the new one. |
consumer_id | string | The consumer this stream reads as: globally unique, chosen by the client. Required, non-empty and at most 65525 bytes of UTF-8; a longer id is refused with INVALID_ARGUMENT. |
incarnation | uint64 | 0 registers the consumer anew with retention, starting at cursor (or the oldest retained entry without one); refused with ALREADY_EXISTS while another incarnation of the id is live. Any other value resumes that live incarnation, and retention is ignored. |
retention | ConsumerRetention | Required when registering (incarnation 0). |
Response: stream ChangeBatch
| Field | Type | Description |
|---|---|---|
units | ChangeUnit[] | The units, in log order. Empty for a batch whose entries carried no unit; the batch still moves cursor. The first may continue a unit an earlier batch began, and the last may stop inside one, which the next batch continues: a transaction with more events than one batch holds arrives in fragments. |
cursor | bytes | Where the stream continues after this batch: pass it on reconnect to resume here, and to AcknowledgeSubscription once the units are held. Opaque; it binds the history, the event interpretation and the interest. |
AcknowledgeSubscription
State that the client holds, durably, every unit of its subscription before cursor: the registration may stop protecting that history, and a stream resumed without a cursor starts there. Only this call releases history; acknowledging an earlier cursor than a previous one changes nothing. Refused with INVALID_ARGUMENT for a cursor past what the serving node has applied (nothing that far was sent) or of another history, and like CancelSubscription for an ended or unknown incarnation.
Request: AcknowledgeSubscriptionRequest
| Field | Type | Description |
|---|---|---|
consumer_id | string | The consumer acknowledging. |
incarnation | uint64 | Its incarnation, from the Subscribe response metadata. |
cursor | bytes | The cursor of the last batch the client no longer needs the source for: it holds the units durably, or it has durably taken their effect into the state it keeps. Everything before it is acknowledged: the server may release that source for this consumer, and a resume without a cursor continues from it. |
Response: AcknowledgeSubscriptionResponse
Empty response (no fields).
CancelSubscription
End a consumer's registration: it stops holding the log, and its incarnation is refused from then on. Refused with FAILED_PRECONDITION and reason CONSUMER_TERMINATED when the incarnation has already ended, and NOT_FOUND for an id never registered.
Request: CancelSubscriptionRequest
| Field | Type | Description |
|---|---|---|
consumer_id | string | The consumer to cancel. |
incarnation | uint64 | The incarnation to cancel, from the Subscribe response metadata. A different incarnation of the same id is left alone. |
Response: CancelSubscriptionResponse
Empty response (no fields).
Types
AcknowledgeSubscriptionRequest
| Field | Type | Description |
|---|---|---|
consumer_id | string | The consumer acknowledging. |
incarnation | uint64 | Its incarnation, from the Subscribe response metadata. |
cursor | bytes | The cursor of the last batch the client no longer needs the source for: it holds the units durably, or it has durably taken their effect into the state it keeps. Everything before it is acknowledged: the server may release that source for this consumer, and a resume without a cursor continues from it. |
AcknowledgeSubscriptionResponse
No fields.
ArrayType
A homogeneous array type.
| Field | Type | Description |
|---|---|---|
element | PropertyType | The type of every element. Required. |
CancelSubscriptionRequest
| Field | Type | Description |
|---|---|---|
consumer_id | string | The consumer to cancel. |
incarnation | uint64 | The incarnation to cancel, from the Subscribe response metadata. A different incarnation of the same id is left alone. |
CancelSubscriptionResponse
No fields.
ChangeBatch
Units read from the log, and where the stream continues after them.
| Field | Type | Description |
|---|---|---|
units | ChangeUnit[] | The units, in log order. Empty for a batch whose entries carried no unit; the batch still moves cursor. The first may continue a unit an earlier batch began, and the last may stop inside one, which the next batch continues: a transaction with more events than one batch holds arrives in fragments. |
cursor | bytes | Where the stream continues after this batch: pass it on reconnect to resume here, and to AcknowledgeSubscription once the units are held. Opaque; it binds the history, the event interpretation and the interest. |
ChangeInterest
What a subscription follows. Absent labels follows the nodes of every label; present and empty follows none. The same for edge_types.
| Field | Type | Description |
|---|---|---|
labels | NameList | Labels whose nodes the subscription follows: a node event reaches it when the node carries one of them before or after the event, its type's implied labels included. A name is bound to the label it names when the subscription opens; one not bound is refused with INVALID_ARGUMENT. |
edge_types | NameList | Relationship types whose relationships the subscription follows, by name. |
blobs | bool | Whether the subscription follows blob objects: what each owner (a stored object, an S3 object, a node's large property) holds, put and removed. They belong to no label. |
ChangeUnit
One committed transaction, or a fragment of one: the events of it in the ordinal range [first_ordinal, end_ordinal) the subscription takes.
| Field | Type | Description |
|---|---|---|
commit_ts | uint64 | HLC commit timestamp of the transaction, in wall-clock microseconds since the Unix epoch with logical increments inside one microsecond. |
log_index | uint64 | The Raft log index of the entry carrying it. |
unit | uint32 | Its place among the transactions of that entry. |
projected | uint32 | How many events the transaction has in all, taken by the subscription or not: with the ordinals of the events received, the client tells it received every event of it its interest takes. |
events | LogicalChange[] | The events the subscription takes, in ordinal order. |
first_ordinal | uint32 | The first ordinal this delivery covers: zero unless an earlier batch delivered the transaction's start. |
end_ordinal | uint32 | The ordinal after the last one this delivery covers, taken by the subscription or not: equal to projected when the delivery reaches the transaction's end. A transaction is complete once its deliveries cover [0, projected). |
ComputedPropertyDefinition
A COMPUTED property of a label: evaluated from each node's data, stored once in the label definition and never per node. Read-only; a write to it is refused.
| Field | Type | Description |
|---|---|---|
name | string | Property name, unique within the label and distinct from every stored property name. |
computed_type | ComputedType | Kind of computed property. Required. |
formula_type | DecayFormulaType | Decay formula, for DECAY and VECTOR_DECAY. Ignored for TTL. |
lambda | double | EXPONENTIAL rate, lambda = ln(2) / half_life_fraction, where half_life_fraction is the half-life as a fraction of duration_secs. |
tau | double | POWER_LAW time scale as a fraction of the duration, greater than 0. |
alpha | double | POWER_LAW exponent, greater than 0. |
initial | double | DECAY value at elapsed = 0. |
target | double | DECAY value once elapsed >= duration_secs. |
duration_secs | uint64 | Length of the decay, or the TTL, in seconds. Greater than 0. |
anchor_field | string | Name of the TIMESTAMP property elapsed time is measured from. Required; must be a stored TIMESTAMP property of the same label. |
scope | TtlScopeType | TTL only: what expiry deletes. |
target_field | string | TTL with scope SUBTREE only: the DOCUMENT property expiry deletes. Empty otherwise. |
ConsumerRetention
Whether a consumer's registration protects the history it still needs. One of the two must be chosen; there is no default.
| Field | Type | Description |
|---|---|---|
strict | StrictRetention | Protection lasts until the consumer is cancelled. Missing heartbeats do not end it, and the log keeps every entry from the acknowledged position on. |
ordinary | OrdinaryRetention | No protection: the registration records the acknowledged position only, and the log's own retention decides how far back it reaches. |
Label
A node label as the catalog holds it.
| Field | Type | Description |
|---|---|---|
name | string | Label name. Case-sensitive. |
declared | bool | False for a label stored nodes carry without a definition; every other field is then empty. |
properties | PropertyDefinition[] | Stored properties, by name. |
computed_properties | ComputedPropertyDefinition[] | Computed properties, by name. |
schema_mode | SchemaMode | How the label validates and stores properties. |
temporal | bool | Whether nodes of the label carry a valid-time interval and keep one version per interval start. Fixed when the label is created. |
schema_revision | uint64 | Revision of the definition. Every published change of the definition or of the label's constraints advances it; a published revision never changes. |
candidate | LabelCandidate | A definition published but not yet in force: the stored nodes are being proved against it. The fields above stay the rules in force until the proof puts it in force; every write meanwhile must satisfy both. Unset when no proof is running. |
kind | LabelKind | Whether the label is a node's type or an auxiliary label. Fixed when the label is created. |
implies | string[] | For a type label, the labels every node of the type carries with it, as declared, sorted: the server writes them, transitively, on each node. Empty for an auxiliary label. Fixed when the label is created. |
LabelCandidate
A label definition published and being proved over the stored nodes.
| Field | Type | Description |
|---|---|---|
properties | PropertyDefinition[] | Stored properties it declares, by name. |
computed_properties | ComputedPropertyDefinition[] | Computed properties it declares, by name. |
schema_mode | SchemaMode | How it validates and stores properties. |
operation | uint64 | The operation proving it: awaited with AwaitSchema, cancelled with CancelIndexBuild. |
implies | LabelCandidateImplies | The labels the type implies once the candidate is in force; absent when the candidate leaves them as they are. Until then the label lookup and every index covering an affected label are reconciled to the new set in the background, and the implications in force still apply. |
LabelCandidateImplies
The implied labels a candidate puts in force, wrapped so that "no change" (absent) and "implies nothing" (present and empty) are told apart.
| Field | Type | Description |
|---|---|---|
labels | string[] | Label names, sorted, without repeats. |
LogicalChange
One effect of a committed transaction.
| Field | Type | Description |
|---|---|---|
ordinal | uint32 | Its place among the transaction's events, counted before any subscription filters them: with log_index and unit, the event's identity, the same for every subscription and every delivery of it. |
action | ChangeAction | What it does to its target. |
payload | bytes | The record or properties a PUT writes, or the delta a PATCH applies, in the storage encoding; empty for a REMOVE and for a relationship's presence. |
delivery | ChangeDelivery | How a node event reaches the subscription's labels: APPLY for a subscription following every label and for every relationship event. |
labels_before | Label[] | The labels a node carried before the transaction, its type's implied ones included; empty for a relationship event. |
labels_after | Label[] | The labels a node carries after the event, its type's implied ones included; empty for a relationship event. |
node | NodeTarget | A node's record, or one version of a temporal node. |
relationship | RelationshipTarget | A relationship's presence. |
properties | RelationshipTarget | The properties of a relationship that is neither versioned nor discriminated. |
instance | RelationshipTarget | One version or discriminated instance of a relationship, its properties included. |
scope | ScopeTarget | The labels a type implies, as one activation of a change to them left them: every node of the type gains and loses labels without a node event of its own. labels_before and labels_after name the type and what it implied before and implies after. |
blob_owner | bytes | What a blob owner holds, by its owner key: a PUT carries the owner record (the blob it now holds, not the blob's bytes), a REMOVE none. |
dropped_label | Label | A label a DROP ended: its identity, which a label created later under the same name does not share. labels_before holds it, labels_after is empty. Nodes of it the same transaction removed are removals of their own. |
MultiVector
An ordered set of equal-width vectors representing one item, as produced by late-interaction retrieval models (ColBERT v2, MaxSim) where a document is several token-level embeddings rather than one pooled vector.
Every row carries the same number of dimensions; the sender enforces that invariant, so a receiver may read rows[0] for the width.
| Field | Type | Description |
|---|---|---|
rows | Vector[] | — |
NameList
A list of names, present even when empty.
| Field | Type | Description |
|---|---|---|
names | string[] | The names. |
NodeTarget
A node and, for a temporal node, the version.
| Field | Type | Description |
|---|---|---|
node_id | uint64 | The node's id. |
valid_from | int64 | The version's start, in milliseconds since the Unix epoch, for a version of a temporal node. |
OrdinaryRetention
Progress only, holding no history.
No fields.
Path
A graph path: the alternating node/relationship sequence produced by shortestPath(...) and by a variable-length MATCH p = (a)-[*]->(b).
rels has exactly one fewer entry than nodes on a non-empty path, and the n-th hop connects nodes[n] to nodes[n+1]. An empty path (a single node, zero hops) carries one node and no relationships.
| Field | Type | Description |
|---|---|---|
nodes | uint64[] | Node ids along the path, start to end. |
rels | PathRel[] | Relationship hops, in the same order. |
PathRel
One relationship hop inside a Path: its type and endpoint node ids. Relationship properties are not carried; fetch them by endpoint pair when they are needed.
| Field | Type | Description |
|---|---|---|
edge_type | string | — |
source | uint64 | — |
target | uint64 | — |
PropertyDefinition
A stored property of a label or edge type. Carries the type facts of one property only; whether its values are unique is a constraint, listed by ListConstraints.
| Field | Type | Description |
|---|---|---|
name | string | Property name, unique within the label or edge type. Case-sensitive. |
type | PropertyType | Declared type of the property's values. Required. |
required | bool | Whether every record must carry a non-null value. A write without one is refused. |
default_value | PropertyValue | Value a record reads when it does not carry the property. Unset: no default, and a missing property reads as null. |
PropertyType
The declared type of a stored property.
| Field | Type | Description |
|---|---|---|
scalar | ScalarType | A type without parameters. |
vector | VectorType | A dense vector with its dimensions and metric. |
array | ArrayType | An array of elements of one type. |
RelationshipTarget
A relationship, by type and endpoints, and its instance when it has one.
| Field | Type | Description |
|---|---|---|
edge_type | string | The relationship type's name. |
source_id | uint64 | The source node's id. |
target_id | uint64 | The target node's id. |
instance | bytes | The version or discriminator of an instance, in its key encoding; empty for a relationship's presence or properties. |
ScopeTarget
A type whose implied labels one activation changed.
| Field | Type | Description |
|---|---|---|
label | Label | The type label. |
activation | uint64 | The activation that put the change in force: distinct for every change, a change back to an earlier declaration included. A subscription keeping state by label reconciles the type's nodes once per activation, or rebuilds the scope. |
StrictRetention
Protection until cancellation.
No fields.
SubscribeRequest
| Field | Type | Description |
|---|---|---|
cursor | bytes | The cursor of the last batch received. Omit to start where the registration stands. |
interest | ChangeInterest | What the subscription follows; with a cursor, the interest it was read with, by the names its labels were created under. A cursor keeps the labels it was read with: when one of them was dropped and its name created again, the stream still reads the dropped label, its DROP included, and not the new one. |
consumer_id | string | The consumer this stream reads as: globally unique, chosen by the client. Required, non-empty and at most 65525 bytes of UTF-8; a longer id is refused with INVALID_ARGUMENT. |
incarnation | uint64 | 0 registers the consumer anew with retention, starting at cursor (or the oldest retained entry without one); refused with ALREADY_EXISTS while another incarnation of the id is live. Any other value resumes that live incarnation, and retention is ignored. |
retention | ConsumerRetention | Required when registering (incarnation 0). |
Timestamp
An instant on the time axis of a TIMESTAMP property.
| Field | Type | Description |
|---|---|---|
unix_micros | int64 | Microseconds since the Unix epoch (1970-01-01T00:00:00Z), signed: an instant before the epoch is negative. Microseconds are the database's own resolution, so the value round-trips exactly; a client converts it to its native type (a nanosecond type reaches it losslessly). |
VectorType
A dense vector type.
| Field | Type | Description |
|---|---|---|
dimensions | uint32 | Number of coordinates every value must have, from 1 to 65536. Zero declares no fixed length: values of any length are accepted, and a vector index takes its dimensions from its own definition. |
metric | DistanceMetric | Distance metric the property is compared by. UNSPECIFIED means COSINE. |
Enums
ChangeAction
What an event does to its target.
| Value | Number | Description |
|---|---|---|
CHANGE_ACTION_UNSPECIFIED | 0 | — |
CHANGE_ACTION_PUT | 1 | The target is written whole: it is replaced, or comes to exist. A PUT does not say which. |
CHANGE_ACTION_PATCH | 2 | The target changes by the payload's delta. |
CHANGE_ACTION_REMOVE | 3 | The target ceases to exist. |
CHANGE_ACTION_SCOPE_CHANGE | 4 | What a type implies changed: its nodes enter and leave label scopes with no node event of their own. |
CHANGE_ACTION_DROP | 5 | A label is dropped: its identity ends, its scope with it. |
ChangeDelivery
How a node event reaches a subscription following some labels.
| Value | Number | Description |
|---|---|---|
CHANGE_DELIVERY_UNSPECIFIED | 0 | — |
CHANGE_DELIVERY_APPLY | 1 | The node is in the subscription's scope before and after: the event applies. |
CHANGE_DELIVERY_ENTER | 2 | The node joins the scope with the record the event writes. |
CHANGE_DELIVERY_LEAVE | 3 | The node leaves the scope: deleted, relabelled or retyped out of it. |
ComputedType
The kind of COMPUTED property.
| Value | Number | Description |
|---|---|---|
COMPUTED_TYPE_UNSPECIFIED | 0 | Not a kind. Refused. |
COMPUTED_TYPE_TTL | 1 | The node, or part of it, is deleted once duration_secs has elapsed since the anchor_field timestamp; scope says which part. |
COMPUTED_TYPE_DECAY | 2 | Value interpolated from initial to target over duration_secs, evaluated when read: initial + (target - initial) * formula(elapsed). |
COMPUTED_TYPE_VECTOR_DECAY | 3 | Multiplier in [0, 1] that a vector similarity score is scaled by when read, from the formula over the time elapsed since anchor_field. |
DecayFormulaType
Decay formula of a DECAY or VECTOR_DECAY computed property. Every formula maps normalized time t in [0, 1] to a weight in [0, 1].
| Value | Number | Description |
|---|---|---|
DECAY_FORMULA_TYPE_UNSPECIFIED | 0 | LINEAR. |
DECAY_FORMULA_TYPE_LINEAR | 1 | f(t) = max(0, 1 - t): constant rate, zero at the end of the duration. |
DECAY_FORMULA_TYPE_EXPONENTIAL | 2 | f(t) = e^(-lambda * t). Requires lambda. |
DECAY_FORMULA_TYPE_POWER_LAW | 3 | f(t) = (1 + t / tau)^(-alpha): fast early decay with a long tail. Requires tau and alpha. |
DECAY_FORMULA_TYPE_STEP | 4 | f(t) = 1 while t < 1, then 0. |
DistanceMetric
| Value | Number | Description |
|---|---|---|
DISTANCE_METRIC_UNSPECIFIED | 0 | — |
DISTANCE_METRIC_COSINE | 1 | — |
DISTANCE_METRIC_L2 | 2 | — |
DISTANCE_METRIC_DOT | 3 | — |
DISTANCE_METRIC_L1 | 4 | — |
LabelKind
What a label is to the nodes carrying it. A node carries exactly one type label, found by kind whatever order its labels are written in, besides the labels that type implies and any auxiliary labels.
| Value | Number | Description |
|---|---|---|
LABEL_KIND_UNSPECIFIED | 0 | TYPE. |
LABEL_KIND_TYPE | 1 | The node's type: its definition gives the node's schema, mode and placement. A label used without a definition is a FLEXIBLE type label. |
LABEL_KIND_AUXILIARY | 2 | Classifies nodes (scope, role, tag). Declares no properties, is not temporal and is never a node's only label. |
ScalarType
The scalar property types: types that take no parameters.
| Value | Number | Description |
|---|---|---|
SCALAR_TYPE_UNSPECIFIED | 0 | Not a type. Refused when a type is required. |
SCALAR_TYPE_STRING | 1 | UTF-8 text. |
SCALAR_TYPE_INT64 | 2 | Signed 64-bit integer. |
SCALAR_TYPE_FLOAT64 | 3 | IEEE 754 binary64 floating point number. |
SCALAR_TYPE_BOOL | 4 | Boolean. |
SCALAR_TYPE_TIMESTAMP | 5 | Point in time. |
SCALAR_TYPE_BLOB | 6 | Large binary object stored apart from the record and read by reference. |
SCALAR_TYPE_BINARY | 7 | Binary value stored inline in the record. |
SCALAR_TYPE_MAP | 8 | Map of string keys to values. |
SCALAR_TYPE_GEO | 9 | Geographic point or shape. |
SCALAR_TYPE_DOCUMENT | 10 | Arbitrary nested document; its content is not type-checked. |
SchemaMode
How a label validates and stores the properties of its nodes.
| Value | Number | Description |
|---|---|---|
SCHEMA_MODE_UNSPECIFIED | 0 | STRICT. |
SCHEMA_MODE_STRICT | 1 | Only declared properties are accepted; a write with any other is refused. Property names are interned, the most compact form. |
SCHEMA_MODE_VALIDATED | 2 | Declared properties are type-checked and interned; other properties are accepted unchecked and stored by name. |
SCHEMA_MODE_FLEXIBLE | 3 | No property is checked against the definition beyond requiredness and defaults; every property is stored by name. |
TtlScopeType
What a TTL computed property deletes when it expires.
| Value | Number | Description |
|---|---|---|
TTL_SCOPE_TYPE_UNSPECIFIED | 0 | NODE. |
TTL_SCOPE_TYPE_FIELD | 1 | Only the anchor_field property; the node remains. |
TTL_SCOPE_TYPE_SUBTREE | 2 | Only the DOCUMENT property named by target_field; the anchor_field timestamp remains. |
TTL_SCOPE_TYPE_NODE | 3 | The whole node with all its edges. |
