share

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestName = "manifest.json"
)

Variables

View Source
var ErrNoManifest = errors.New("share manifest not found")
View Source
var SnapshotTables = []string{
	"workspaces",
	"channels",
	"users",
	"messages",
	"message_files",
	"message_events",
	"message_mentions",
	"sync_state",
	"embedding_jobs",
}

Functions

func Commit

func Commit(ctx context.Context, opts Options, message string) (bool, error)

func EnsureRepo

func EnsureRepo(ctx context.Context, opts Options) error

func ManifestAlreadyImported

func ManifestAlreadyImported(ctx context.Context, s *store.Store, manifest Manifest) bool

func MarkImported

func MarkImported(ctx context.Context, s *store.Store, manifest Manifest) error

func NeedsImport

func NeedsImport(ctx context.Context, s *store.Store, staleAfter time.Duration) bool

func Pull

func Pull(ctx context.Context, opts Options) error

func Push

func Push(ctx context.Context, opts Options) error

Types

type Manifest

type Manifest struct {
	Version     int               `json:"version"`
	GeneratedAt time.Time         `json:"generated_at"`
	Tables      []TableManifest   `json:"tables"`
	Media       *MediaManifest    `json:"media,omitempty"`
	Files       map[string]string `json:"files,omitempty"`
}

func Export

func Export(ctx context.Context, s *store.Store, opts Options) (Manifest, error)

func Import

func Import(ctx context.Context, s *store.Store, opts Options) (Manifest, error)

func ImportIfChanged

func ImportIfChanged(ctx context.Context, s *store.Store, opts Options) (Manifest, bool, error)

func ReadManifest

func ReadManifest(repoPath string) (Manifest, error)

type MediaFileManifest

type MediaFileManifest struct {
	Path   string `json:"path"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

type MediaManifest

type MediaManifest struct {
	Files int                 `json:"files"`
	Bytes int64               `json:"bytes"`
	Items []MediaFileManifest `json:"items,omitempty"`
}

type Options

type Options struct {
	RepoPath     string
	Remote       string
	Branch       string
	CacheDir     string
	IncludeMedia bool
}

type SyncState

type SyncState struct {
	LastImportAt            time.Time `json:"last_import_at"`
	LastManifestGeneratedAt time.Time `json:"last_manifest_generated_at"`
}

func ReadSyncState

func ReadSyncState(ctx context.Context, s *store.Store) (SyncState, error)

type TableManifest

type TableManifest struct {
	Name    string   `json:"name"`
	File    string   `json:"file,omitempty"`
	Files   []string `json:"files,omitempty"`
	Columns []string `json:"columns"`
	Rows    int      `json:"rows"`
}

Jump to

Keyboard shortcuts

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