sync

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sync implements git-based chunk sync for team memory sharing.

Layout (committed to git):

.yaad/
  manifest.json          ← index of all chunks (small, git-mergeable)
  chunks/
    a3f8c1d2.jsonl.gz    ← chunk (gzipped JSONL, append-only)
    b7d2e4f1.jsonl.gz

Each `yaad sync` creates a NEW chunk file — old chunks are never modified. No merge conflicts, just append-only git history.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkMeta

type ChunkMeta struct {
	Hash      string    `json:"hash"`
	File      string    `json:"file"`
	CreatedAt time.Time `json:"created_at"`
	NodeCount int       `json:"node_count"`
	EdgeCount int       `json:"edge_count"`
}

ChunkMeta describes a single chunk file.

type ChunkRecord

type ChunkRecord struct {
	Kind string          `json:"kind"` // "node" or "edge"
	Data json.RawMessage `json:"data"`
}

ChunkRecord is a single JSONL line in a chunk file.

type Manifest

type Manifest struct {
	Version   string      `json:"version"`
	UpdatedAt time.Time   `json:"updated_at"`
	Chunks    []ChunkMeta `json:"chunks"`
}

Manifest tracks all known chunks.

type Status

type Status struct {
	TotalChunks    int
	ImportedChunks int
	PendingChunks  int
}

Status returns sync status.

type Syncer

type Syncer struct {
	// contains filtered or unexported fields
}

Syncer manages chunk-based sync.

func New

func New(store *storage.Store, projectDir string) *Syncer

New creates a Syncer for the given project directory.

func (*Syncer) Export

func (s *Syncer) Export(project string) (string, error)

Export creates a new chunk from all current nodes/edges and updates the manifest. Returns the chunk hash.

func (*Syncer) Import

func (s *Syncer) Import() (int, int, error)

Import reads all chunks from the manifest that aren't already imported. Returns counts of imported nodes and edges.

func (*Syncer) Status

func (s *Syncer) Status() (*Status, error)

Jump to

Keyboard shortcuts

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