syncdb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package syncdb provides SQLite-based sync state management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB wraps the SQLite database connection.

func Open

func Open(path string) (*DB, error)

Open opens or creates the sync database.

func (*DB) ClearFileMessages

func (d *DB) ClearFileMessages(filePath string) error

ClearFileMessages clears all synced messages for a file. Used when compaction is detected.

func (*DB) Close

func (d *DB) Close() error

Close closes the database connection.

func (*DB) DeleteState

func (d *DB) DeleteState(filePath string) error

DeleteState removes the sync state for a file.

func (*DB) GetAllStates

func (d *DB) GetAllStates() ([]*SyncState, error)

GetAllStates returns all sync states.

func (*DB) GetState

func (d *DB) GetState(filePath string) (*SyncState, error)

GetState retrieves the sync state for a file.

func (*DB) IsSynced

func (d *DB) IsSynced(filePath, messageHash string) (bool, error)

IsSynced checks if a message has been synced.

func (*DB) RecordError

func (d *DB) RecordError(filePath, errorMsg string) error

RecordError records a sync error.

func (*DB) RecordSyncedMessage

func (d *DB) RecordSyncedMessage(filePath, messageHash, spanID string) error

RecordSyncedMessage records that a message has been synced.

func (*DB) SaveState

func (d *DB) SaveState(state *SyncState) error

SaveState saves the sync state for a file.

func (*DB) Stats

func (d *DB) Stats() (*Stats, error)

Stats returns database statistics.

type Stats

type Stats struct {
	TrackedFiles   int
	SyncedMessages int
	TotalMessages  int
}

Stats holds database statistics.

type SyncState

type SyncState struct {
	FilePath     string
	LastOffset   int64
	LastSize     int64
	LastMtime    int64
	TraceID      string
	MessageCount int
	LastSyncAt   int64
	Backend      string
}

SyncState represents the sync state for a single file.

Jump to

Keyboard shortcuts

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