Documentation
¶
Overview ¶
Package state is the daemon's SQLite state store (spec §4.3).
Index ¶
- type Backlog
- type DB
- func (d *DB) AddSkipped(ctx context.Context, s Skipped) error
- func (d *DB) Backlog(ctx context.Context) (Backlog, error)
- func (d *DB) Close() error
- func (d *DB) Delete(ctx context.Context, relPath, headHash string) error
- func (d *DB) Get(ctx context.Context, relPath, headHash string) (File, bool, error)
- func (d *DB) HasSkipped(ctx context.Context, relPath, headHash string) (bool, error)
- func (d *DB) List(ctx context.Context) ([]File, error)
- func (d *DB) ListSkipped(ctx context.Context) ([]Skipped, error)
- func (d *DB) Put(ctx context.Context, f File) error
- func (d *DB) ResetAcks(ctx context.Context) error
- func (d *DB) SetSetting(ctx context.Context, key, value string) error
- func (d *DB) Setting(ctx context.Context, key string) (string, bool, error)
- type File
- type Skipped
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backlog ¶
type Backlog struct {
Files int
Bytes int64
OldestUnacked time.Time // min last_ack_at among backlog files; zero if none ever acked
LastAck time.Time // max last_ack_at over all files
}
Backlog summarises unacked work.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the SQLite connection pool.
func (*DB) AddSkipped ¶
AddSkipped records an entry; recording it again is a no-op.
func (*DB) Backlog ¶
Backlog counts append files with acked_offset < size_seen and snapshot files flagged with size_seen = -1 (changed, not acked).
func (*DB) HasSkipped ¶
HasSkipped reports whether the file has a skipped entry (its spool copy must be kept).
func (*DB) ListSkipped ¶
ListSkipped returns all skipped entries ordered by path and offset.
func (*DB) ResetAcks ¶
ResetAcks forgets everything the server acknowledged (offsets, snapshot hashes, the resume marker) so the whole history is sent again to a new device. Spool paths and file ids stay.
func (*DB) SetSetting ¶
SetSetting upserts a setting.
type File ¶
type File struct {
RelPath, HeadHash string
Kind protocol.Kind
AckedOffset int64
ContentHash string
FileID string
SizeSeen int64
SpoolPath string
OriginalGone bool
LastAckAt time.Time // zero if never
DeviceScoped bool // the server answered conflict: send with scope "device"
}
File is one row of the files table.