syncplanecursorv1

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_syncplane_cursor_v1_cursor_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type BootstrapPosition

type BootstrapPosition struct {

	// Entities whose scan ran to completion, in no particular order. Every row
	// of these that the snapshot ships has been delivered.
	Done []string `protobuf:"bytes,1,rep,name=done,proto3" json:"done,omitempty"`
	// The entity that was mid-scan, and the last row key delivered within it.
	// The resumed scan restarts this entity after that key. Empty when the
	// interruption fell on an entity boundary.
	Entity   string `protobuf:"bytes,2,opt,name=entity,proto3" json:"entity,omitempty"`
	AfterKey string `protobuf:"bytes,3,opt,name=after_key,json=afterKey,proto3" json:"after_key,omitempty"`
	// contains filtered or unexported fields
}

BootstrapPosition is how far an interrupted Bootstrap got: what rides inside the opaque BootstrapResume.token. It records the delivered set by NAME rather than as a position in the delivery order, because that order is not stable across attempts — a client may ask for different priority entities, and the catalog may gain an entity between attempts. A resumed scan then skips exactly what already shipped and covers everything else in full, whatever order the resumed stream delivers it in.

func (*BootstrapPosition) Descriptor deprecated

func (*BootstrapPosition) Descriptor() ([]byte, []int)

Deprecated: Use BootstrapPosition.ProtoReflect.Descriptor instead.

func (*BootstrapPosition) GetAfterKey

func (x *BootstrapPosition) GetAfterKey() string

func (*BootstrapPosition) GetDone

func (x *BootstrapPosition) GetDone() []string

func (*BootstrapPosition) GetEntity

func (x *BootstrapPosition) GetEntity() string

func (*BootstrapPosition) ProtoMessage

func (*BootstrapPosition) ProtoMessage()

func (*BootstrapPosition) ProtoReflect

func (x *BootstrapPosition) ProtoReflect() protoreflect.Message

func (*BootstrapPosition) Reset

func (x *BootstrapPosition) Reset()

func (*BootstrapPosition) String

func (x *BootstrapPosition) String() string

type ClosureSet

type ClosureSet struct {
	Entries []*ClosureSet_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

ClosureSet records a bounded membership set as a per-entity list of row keys. Two features ride on it — the reference-following closure and the windowed subscription set — because both are memberships that cannot be derived per row and so must be STORED to be diffed. Keeping the prior set (rather than reconstructing it from a spec) is what makes drops exact.

func (*ClosureSet) Descriptor deprecated

func (*ClosureSet) Descriptor() ([]byte, []int)

Deprecated: Use ClosureSet.ProtoReflect.Descriptor instead.

func (*ClosureSet) GetEntries

func (x *ClosureSet) GetEntries() []*ClosureSet_Entry

func (*ClosureSet) ProtoMessage

func (*ClosureSet) ProtoMessage()

func (*ClosureSet) ProtoReflect

func (x *ClosureSet) ProtoReflect() protoreflect.Message

func (*ClosureSet) Reset

func (x *ClosureSet) Reset()

func (*ClosureSet) String

func (x *ClosureSet) String() string

type ClosureSet_Entry

type ClosureSet_Entry struct {
	Entity string   `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
	Keys   []string `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"`
	// contains filtered or unexported fields
}

func (*ClosureSet_Entry) Descriptor deprecated

func (*ClosureSet_Entry) Descriptor() ([]byte, []int)

Deprecated: Use ClosureSet_Entry.ProtoReflect.Descriptor instead.

func (*ClosureSet_Entry) GetEntity

func (x *ClosureSet_Entry) GetEntity() string

func (*ClosureSet_Entry) GetKeys

func (x *ClosureSet_Entry) GetKeys() []string

func (*ClosureSet_Entry) ProtoMessage

func (*ClosureSet_Entry) ProtoMessage()

func (*ClosureSet_Entry) ProtoReflect

func (x *ClosureSet_Entry) ProtoReflect() protoreflect.Message

func (*ClosureSet_Entry) Reset

func (x *ClosureSet_Entry) Reset()

func (*ClosureSet_Entry) String

func (x *ClosureSet_Entry) String() string

type Cursor

type Cursor struct {

	// Workspace sequence the client has seen through.
	Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"`
	// Hash of the subscription set the cursor was issued under; 0 = full sync.
	// A mismatch on the next pull starts a delta resync into the new set (or
	// forces reset when the old set cannot be reconstructed).
	SubHash uint64 `protobuf:"fixed64,2,opt,name=sub_hash,json=subHash,proto3" json:"sub_hash,omitempty"`
	// Permissions filter epoch the cursor was issued under. A mismatch starts
	// a delta resync (apps implementing EpochReadFilters) or forces reset, so
	// visibility changes outside row edits propagate to clients.
	FilterEpoch uint64 `protobuf:"varint,3,opt,name=filter_epoch,json=filterEpoch,proto3" json:"filter_epoch,omitempty"`
	// The subscription set the cursor was issued under (the set sub_hash
	// hashes). Lets the server reconstruct the client's old scope and resync
	// only the visible-set difference after a subscription change.
	Subscriptions []*v1.Subscription `protobuf:"bytes,4,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"`
	// Present while a delta resync is paging; absent on a settled cursor.
	Resync *ResyncState `protobuf:"bytes,5,opt,name=resync,proto3" json:"resync,omitempty"`
	// Sub-position inside a same-version group when a pull page splits one.
	// Multiple rows can share one workspace sequence (a BatchMutation, a
	// multi-row custom mutator, Server.Mutate/Invoke). When a page boundary
	// lands inside such a group, seq names that version and these name the
	// last row already delivered within it (in (entity, key) order), so the
	// next pull resumes at the remaining rows instead of skipping them.
	// Empty on a clean version boundary (the common case).
	PartialEntity string `protobuf:"bytes,6,opt,name=partial_entity,json=partialEntity,proto3" json:"partial_entity,omitempty"`
	PartialKey    string `protobuf:"bytes,7,opt,name=partial_key,json=partialKey,proto3" json:"partial_key,omitempty"`
	// A random per-workspace identity, minted when the workspace is first
	// written and stable for its lifetime. It pins a cursor to the store
	// lineage that issued it: a cursor stamped with one epoch presented to a
	// store carrying a different one cannot have come from this store (the URL
	// now serves a swapped, recreated, or restored database), so pull resets
	// rather than splicing two lineages' histories together. 0 = a pre-write
	// cursor that carries no epoch; the server stamps the current one onto
	// every cursor it issues going forward.
	StoreEpoch uint64 `protobuf:"fixed64,8,opt,name=store_epoch,json=storeEpoch,proto3" json:"store_epoch,omitempty"`
	// The reference-following closure the cursor was issued under: the exact
	// set of (entity, key) rows the client holds via `follow` beyond its base
	// scope. The next pull brings the closure up to date against current data
	// and diffs it against this set, emitting rows that entered and tombstoning
	// rows that left (and are not otherwise base-visible) — which is also what
	// makes the set the INPUT to that update, since a member nothing touched
	// carries straight over. Absent on non-following subscriptions ⇒ empty.
	// Bounded by the server's MaxClosureSize, so the cursor stays bounded.
	Closure *ClosureSet `protobuf:"bytes,9,opt,name=closure,proto3" json:"closure,omitempty"`
	// The windowed membership the cursor was issued under, as ONE set across
	// every window: the exact rows the client holds via a Subscription.window.
	// The next pull diffs its recomputed membership against this, so rows that
	// fell off the tail are dropped precisely rather than lingering.
	//
	// Written only by servers that predate `windows`, and read only from such a
	// cursor; a cursor carrying `windows` leaves this empty and the union is
	// derived. Both forms diff identically — the split one additionally says
	// which window holds what, which is what maintaining a window costs less
	// than rebuilding it.
	Window *ClosureSet `protobuf:"bytes,10,opt,name=window,proto3" json:"window,omitempty"`
	// The windowed membership split per window, one entry per
	// Subscription.window in `subscriptions` order. Absent on non-windowed
	// subscriptions and on cursors older than this field. Bounded by the
	// server's MaxWindowSize per windowed subscription.
	Windows []*WindowState `protobuf:"bytes,11,rep,name=windows,proto3" json:"windows,omitempty"`
	// Reference to an externally stored StoredSets entry holding what fields
	// 4, 9, 10 and 11 would otherwise inline. When set, those fields are empty
	// and the sets live in the server's cursor-state store; the cursor itself
	// stays a few dozen bytes however large the client's membership grows.
	// A referenced entry the store no longer holds resets the client, exactly
	// as a cursor below the tombstone horizon does — which is why servers
	// without a store, and entries too small to be worth a store round trip,
	// keep inlining instead.
	SetsRef *StateRef `protobuf:"bytes,12,opt,name=sets_ref,json=setsRef,proto3" json:"sets_ref,omitempty"`
	// Set when `closure` was produced under a subscription set other than
	// `subscriptions`: a delta resync carries the old scope's closure onto the
	// cursor it completes with, because the resync reconciles base scope only
	// and leaves the closure to the pull that follows. The set still names
	// exactly the rows the client holds via `follow`, so the diff against it
	// stays exact, but it cannot be maintained from what changed since seq —
	// the seeds and paths it was walked from are the old scope's. The next
	// following pull walks the closure again from the new scope's seeds, and
	// clears this once it stores the rebuilt set at a clean version boundary.
	ClosureRebuild bool `protobuf:"varint,13,opt,name=closure_rebuild,json=closureRebuild,proto3" json:"closure_rebuild,omitempty"`
	// Set on the cursor a delta resync completes with, and cleared by the pull
	// that follows it. The resync reconciles the client's rows as of seq only,
	// so a row an added entity gained past seq reaches the client for the first
	// time on that catch-up page — which therefore ships every row as full
	// state, since delta state presumes the client holds the row as of seq.
	Resynced bool `protobuf:"varint,14,opt,name=resynced,proto3" json:"resynced,omitempty"`
	// contains filtered or unexported fields
}

Cursor is the server's pull-position state.

func (*Cursor) Descriptor deprecated

func (*Cursor) Descriptor() ([]byte, []int)

Deprecated: Use Cursor.ProtoReflect.Descriptor instead.

func (*Cursor) GetClosure

func (x *Cursor) GetClosure() *ClosureSet

func (*Cursor) GetClosureRebuild

func (x *Cursor) GetClosureRebuild() bool

func (*Cursor) GetFilterEpoch

func (x *Cursor) GetFilterEpoch() uint64

func (*Cursor) GetPartialEntity

func (x *Cursor) GetPartialEntity() string

func (*Cursor) GetPartialKey

func (x *Cursor) GetPartialKey() string

func (*Cursor) GetResync

func (x *Cursor) GetResync() *ResyncState

func (*Cursor) GetResynced

func (x *Cursor) GetResynced() bool

func (*Cursor) GetSeq

func (x *Cursor) GetSeq() uint64

func (*Cursor) GetSetsRef

func (x *Cursor) GetSetsRef() *StateRef

func (*Cursor) GetStoreEpoch

func (x *Cursor) GetStoreEpoch() uint64

func (*Cursor) GetSubHash

func (x *Cursor) GetSubHash() uint64

func (*Cursor) GetSubscriptions

func (x *Cursor) GetSubscriptions() []*v1.Subscription

func (*Cursor) GetWindow

func (x *Cursor) GetWindow() *ClosureSet

func (*Cursor) GetWindows

func (x *Cursor) GetWindows() []*WindowState

func (*Cursor) ProtoMessage

func (*Cursor) ProtoMessage()

func (*Cursor) ProtoReflect

func (x *Cursor) ProtoReflect() protoreflect.Message

func (*Cursor) Reset

func (x *Cursor) Reset()

func (*Cursor) String

func (x *Cursor) String() string

type ResyncState

type ResyncState struct {

	// Scan position: the next page resumes at the first subscribed entity
	// >= entity, skipping keys <= after_key within it.
	Entity   string `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
	AfterKey string `protobuf:"bytes,2,opt,name=after_key,json=afterKey,proto3" json:"after_key,omitempty"`
	// The scope the resync converges on. Each resync pull must still carry a
	// subscription set hashing to to_sub_hash and find the workspace at
	// to_filter_epoch; any further change mid-resync falls back to reset.
	ToSubHash     uint64 `protobuf:"fixed64,3,opt,name=to_sub_hash,json=toSubHash,proto3" json:"to_sub_hash,omitempty"`
	ToFilterEpoch uint64 `protobuf:"varint,4,opt,name=to_filter_epoch,json=toFilterEpoch,proto3" json:"to_filter_epoch,omitempty"`
	// contains filtered or unexported fields
}

ResyncState marks a cursor mid delta-resync: the difference between the client's old visible set (under the Cursor's seq / sub_hash / filter_epoch / subscriptions) and its new one is streaming out in (entity, key) scan order. Rows written after the Cursor's seq are not part of the scan; the catch-up pull that follows the resync delivers them under the new scope.

func (*ResyncState) Descriptor deprecated

func (*ResyncState) Descriptor() ([]byte, []int)

Deprecated: Use ResyncState.ProtoReflect.Descriptor instead.

func (*ResyncState) GetAfterKey

func (x *ResyncState) GetAfterKey() string

func (*ResyncState) GetEntity

func (x *ResyncState) GetEntity() string

func (*ResyncState) GetToFilterEpoch

func (x *ResyncState) GetToFilterEpoch() uint64

func (*ResyncState) GetToSubHash

func (x *ResyncState) GetToSubHash() uint64

func (*ResyncState) ProtoMessage

func (*ResyncState) ProtoMessage()

func (*ResyncState) ProtoReflect

func (x *ResyncState) ProtoReflect() protoreflect.Message

func (*ResyncState) Reset

func (x *ResyncState) Reset()

func (*ResyncState) String

func (x *ResyncState) String() string

type StateRef

type StateRef struct {
	Id  uint64 `protobuf:"fixed64,1,opt,name=id,proto3" json:"id,omitempty"`
	Gen uint64 `protobuf:"fixed64,2,opt,name=gen,proto3" json:"gen,omitempty"`
	// contains filtered or unexported fields
}

StateRef names one immutable entry in the cursor-state store. The pair is the identity: id is the lineage a client's successive cursors share (minted when a snapshot starts, carried forward on every reissue, and what lets a store prune a lineage's superseded entries), gen distinguishes the entries within it and is random rather than sequential, so two pulls advancing the same cursor concurrently write two entries instead of colliding on one.

func (*StateRef) Descriptor deprecated

func (*StateRef) Descriptor() ([]byte, []int)

Deprecated: Use StateRef.ProtoReflect.Descriptor instead.

func (*StateRef) GetGen

func (x *StateRef) GetGen() uint64

func (*StateRef) GetId

func (x *StateRef) GetId() uint64

func (*StateRef) ProtoMessage

func (*StateRef) ProtoMessage()

func (*StateRef) ProtoReflect

func (x *StateRef) ProtoReflect() protoreflect.Message

func (*StateRef) Reset

func (x *StateRef) Reset()

func (*StateRef) String

func (x *StateRef) String() string

type StoredSets

type StoredSets struct {

	// Cursor.subscriptions.
	Subscriptions []*v1.Subscription `protobuf:"bytes,1,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"`
	// Cursor.closure.
	Closure *ClosureSet `protobuf:"bytes,2,opt,name=closure,proto3" json:"closure,omitempty"`
	// Cursor.windows.
	Windows []*WindowState `protobuf:"bytes,3,rep,name=windows,proto3" json:"windows,omitempty"`
	// Cursor.window — carried only when adopting a cursor from a server that
	// predates `windows`, so nothing is lost in the exchange.
	Window *ClosureSet `protobuf:"bytes,4,opt,name=window,proto3" json:"window,omitempty"`
	// contains filtered or unexported fields
}

StoredSets is the bulky tail of a Cursor, stored once instead of restated on every page: the subscription set and both bounded membership key-sets. Encoded deterministically — each key list sorted unless its order is meaningful, as closureRows.keySet and rowEmitter.windowStates emit them — so equal membership produces equal bytes and a reissued cursor keeps its ref instead of writing a new entry.

func (*StoredSets) Descriptor deprecated

func (*StoredSets) Descriptor() ([]byte, []int)

Deprecated: Use StoredSets.ProtoReflect.Descriptor instead.

func (*StoredSets) GetClosure

func (x *StoredSets) GetClosure() *ClosureSet

func (*StoredSets) GetSubscriptions

func (x *StoredSets) GetSubscriptions() []*v1.Subscription

func (*StoredSets) GetWindow

func (x *StoredSets) GetWindow() *ClosureSet

func (*StoredSets) GetWindows

func (x *StoredSets) GetWindows() []*WindowState

func (*StoredSets) ProtoMessage

func (*StoredSets) ProtoMessage()

func (*StoredSets) ProtoReflect

func (x *StoredSets) ProtoReflect() protoreflect.Message

func (*StoredSets) Reset

func (x *StoredSets) Reset()

func (*StoredSets) String

func (x *StoredSets) String() string

type WindowState

type WindowState struct {

	// Index into Cursor.subscriptions of the windowed subscription this
	// describes. A pull that cannot line its own subscription list up with the
	// cursor's, position for position, rebuilds instead of maintaining.
	Subscription uint32 `protobuf:"varint,1,opt,name=subscription,proto3" json:"subscription,omitempty"`
	// Member row keys of that subscription's entity.
	//
	// Ordered best-first for a by_recency window, where the order is
	// maintainable for free — every row written since the cursor outranks every
	// member, so entering rows go to the front and evictions come off the tail.
	// An order_by window cannot place an entering row without reading its
	// neighbours, so it locates the tail with `boundary` instead and leaves
	// these sorted.
	Keys []string `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"`
	// The weakest member's position in the window's order_by ordering, as the
	// bytes query.Order.Cursor produces. Empty for a by_recency window (which
	// needs no comparison, see `keys`) and for an empty window.
	Boundary []byte `protobuf:"bytes,3,opt,name=boundary,proto3" json:"boundary,omitempty"`
	// contains filtered or unexported fields
}

WindowState is one Subscription.window's membership plus the position of its weakest member. The position is what lets a pull decide a changed row's membership by COMPARISON — is it ahead of the tail? — instead of resolving the window from scratch, which costs a read per member however little moved.

func (*WindowState) Descriptor deprecated

func (*WindowState) Descriptor() ([]byte, []int)

Deprecated: Use WindowState.ProtoReflect.Descriptor instead.

func (*WindowState) GetBoundary

func (x *WindowState) GetBoundary() []byte

func (*WindowState) GetKeys

func (x *WindowState) GetKeys() []string

func (*WindowState) GetSubscription

func (x *WindowState) GetSubscription() uint32

func (*WindowState) ProtoMessage

func (*WindowState) ProtoMessage()

func (*WindowState) ProtoReflect

func (x *WindowState) ProtoReflect() protoreflect.Message

func (*WindowState) Reset

func (x *WindowState) Reset()

func (*WindowState) String

func (x *WindowState) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL