Documentation
¶
Overview ¶
Package vecsync defines foundational types for SCN-based synchronization between an upstream SQL database (authoritative shadow tables and vec_shadow_log) and downstream SQLite replicas. Higher-level sync coordinators will live in this package incrementally; at this stage it contains the shared metadata structures used by both the ingestion/log producer and the replicator.
Index ¶
Constants ¶
const ( // DefaultLogTable is the upstream change-log table that captures row-level SCN events. DefaultLogTable = "vec_shadow_log" // DefaultSeqTable stores the next SCN per dataset on the upstream database. DefaultSeqTable = "vec_dataset_scn" )
Variables ¶
This section is empty.
Functions ¶
func LogTableDDL ¶
func LogTableDDL() string
LogTableDDL returns the DDL for vec_shadow_log, which upstream databases populate via triggers whenever the shadow table changes.
func MySQLShadowLogTriggers ¶
MySQLShadowLogTriggers returns AFTER INSERT/UPDATE/DELETE trigger definitions that populate vec_shadow_log with JSON payloads (hex-encoded embeddings) and per-dataset SCNs. Callers are responsible for wrapping the statements with an appropriate DELIMITER when executing them.
func SQLiteShadowLogTriggers ¶
SQLiteShadowLogTriggers returns the trigger DDL statements required to capture inserts, updates, and deletes against a shadow table into vec_shadow_log using SQLite syntax. The payload is serialized as JSON with a hex-encoded embedding.
func SeqTableDDL ¶
func SeqTableDDL() string
SeqTableDDL returns the DDL for tracking next SCN per dataset (optional helper).
func ShadowTableDDL ¶
ShadowTableDDL returns the base DDL snippet for upstream shadow tables with SCN support. Callers can embed this SQL when creating dataset-aware document stores. The DDL assumes SQLite/MySQL-compatible syntax; adapt as needed for other engines.
Types ¶
type Config ¶
type Config struct {
// DatasetID identifies the dataset slice being synchronized.
DatasetID string
// ShadowTable is the fully-qualified shadow table name (e.g., "main.shadow_vec_docs").
ShadowTable string
// BatchSize controls how many log entries to fetch/apply per sync iteration.
BatchSize int
}
Config captures the settings needed to perform SCN-based replication from an upstream SQL database into a local SQLite shadow table. Subsequent sync components will build on this struct.