sqlite

package
v0.0.0-...-a298fb4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MPL-2.0 Imports: 34 Imported by: 0

Documentation

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
}

func Open

func Open(path string, opts ...Option) (*DB, error)

func OpenForMigration

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

Open the database with options suitable for the migration inserts. This is not a safe mode of operation for normal processing, use only for bulk inserts with a close afterwards.

func OpenTemp

func OpenTemp() (*DB, error)

func (*DB) AllGlobalFiles

func (s *DB) AllGlobalFiles(folder string) (iter.Seq[db.FileMetadata], func() error)

func (*DB) AllGlobalFilesPrefix

func (s *DB) AllGlobalFilesPrefix(folder string, prefix string) (iter.Seq[db.FileMetadata], func() error)

func (*DB) AllLocalBlocksWithHash

func (s *DB) AllLocalBlocksWithHash(folder string, hash []byte) (iter.Seq[db.BlockMapEntry], func() error)

func (*DB) AllLocalFiles

func (s *DB) AllLocalFiles(folder string, device protocol.DeviceID) (iter.Seq[protocol.FileInfo], func() error)

func (*DB) AllLocalFilesBySequence

func (s *DB) AllLocalFilesBySequence(folder string, device protocol.DeviceID, startSeq int64, limit int) (iter.Seq[protocol.FileInfo], func() error)

func (*DB) AllLocalFilesWithBlocksHash

func (s *DB) AllLocalFilesWithBlocksHash(folder string, h []byte) (iter.Seq[db.FileMetadata], func() error)

func (*DB) AllLocalFilesWithPrefix

func (s *DB) AllLocalFilesWithPrefix(folder string, device protocol.DeviceID, prefix string) (iter.Seq[protocol.FileInfo], func() error)

func (*DB) AllNeededGlobalFiles

func (s *DB) AllNeededGlobalFiles(folder string, device protocol.DeviceID, order config.PullOrder, limit, offset int) (iter.Seq[protocol.FileInfo], func() error)

func (*DB) Close

func (s *DB) Close() error

func (*DB) CountGlobal

func (s *DB) CountGlobal(folder string) (db.Counts, error)

func (*DB) CountLocal

func (s *DB) CountLocal(folder string, device protocol.DeviceID) (db.Counts, error)

func (*DB) CountNeed

func (s *DB) CountNeed(folder string, device protocol.DeviceID) (db.Counts, error)

func (*DB) CountReceiveOnlyChanged

func (s *DB) CountReceiveOnlyChanged(folder string) (db.Counts, error)

func (DB) DeleteKV

func (s DB) DeleteKV(key string) error

func (*DB) DeleteMtime

func (s *DB) DeleteMtime(folder, name string) error

func (*DB) DropAllFiles

func (s *DB) DropAllFiles(folder string, device protocol.DeviceID) error

func (*DB) DropAllIndexIDs

func (s *DB) DropAllIndexIDs() error

func (*DB) DropDevice

func (s *DB) DropDevice(device protocol.DeviceID) error

func (*DB) DropFilesNamed

func (s *DB) DropFilesNamed(folder string, device protocol.DeviceID, names []string) error

func (*DB) DropFolder

func (s *DB) DropFolder(folder string) error

func (*DB) GetDeviceFile

func (s *DB) GetDeviceFile(folder string, device protocol.DeviceID, file string) (protocol.FileInfo, bool, error)

func (*DB) GetDeviceSequence

func (s *DB) GetDeviceSequence(folder string, device protocol.DeviceID) (int64, error)

func (*DB) GetGlobalAvailability

func (s *DB) GetGlobalAvailability(folder, file string) ([]protocol.DeviceID, error)

func (*DB) GetGlobalFile

func (s *DB) GetGlobalFile(folder string, file string) (protocol.FileInfo, bool, error)

func (*DB) GetIndexID

func (s *DB) GetIndexID(folder string, device protocol.DeviceID) (protocol.IndexID, error)

func (DB) GetKV

func (s DB) GetKV(key string) ([]byte, error)

func (*DB) GetMtime

func (s *DB) GetMtime(folder, name string) (ondisk, virtual time.Time)

func (*DB) ListDevicesForFolder

func (s *DB) ListDevicesForFolder(folder string) ([]protocol.DeviceID, error)

func (*DB) ListFolders

func (s *DB) ListFolders() ([]string, error)

func (DB) PrefixKV

func (s DB) PrefixKV(prefix string) (iter.Seq[db.KeyValue], func() error)

func (DB) PutKV

func (s DB) PutKV(key string, val []byte) error

func (*DB) PutMtime

func (s *DB) PutMtime(folder, name string, ondisk, virtual time.Time) error

func (*DB) RemoteSequences

func (s *DB) RemoteSequences(folder string) (map[protocol.DeviceID]int64, error)

func (*DB) Service

func (s *DB) Service(maintenanceInterval time.Duration) suture.Service

func (*DB) SetIndexID

func (s *DB) SetIndexID(folder string, device protocol.DeviceID, id protocol.IndexID) error

func (*DB) Statistics

func (s *DB) Statistics() (*DatabaseStatistics, error)

func (*DB) Update

func (s *DB) Update(folder string, device protocol.DeviceID, fs []protocol.FileInfo) error

type DatabaseStatistics

type DatabaseStatistics struct {
	Name     string               `json:"name"`
	FolderID string               `json:"folderID,omitempty"`
	Tables   []TableStatistics    `json:"tables"`
	Total    TableStatistics      `json:"total"`
	Children []DatabaseStatistics `json:"children,omitempty"`
}

type Option

type Option func(*DB)

func WithDeleteRetention

func WithDeleteRetention(d time.Duration) Option

type Service

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

func (*Service) Serve

func (s *Service) Serve(ctx context.Context) error

func (*Service) String

func (s *Service) String() string

type TableStatistics

type TableStatistics struct {
	Name   string `json:"name,omitempty"`
	Size   int64  `json:"size"`
	Unused int64  `json:"unused"`
}

Jump to

Keyboard shortcuts

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