caching

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: ISC Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const CACHE_VERSION = "2.0.0"

Variables

View Source
var (
	ErrClosed = fmt.Errorf("cache closed")
)

Functions

This section is empty.

Types

type Batch added in v1.0.10

type Batch interface {
	Put([]byte, []byte) error
	Count() uint32
	Commit() error
}

This is not goroutine safe, external synchronization must be provided.

type Cache added in v1.0.10

type Cache interface {
	Put([]byte, []byte) error
	Has([]byte) (bool, error)
	Get([]byte) ([]byte, error)

	// Must support Delete during Scan
	Delete([]byte) error

	// reverse is only to accomodate EnumerateKeysWithPrefix, once
	// that doesn't need it anymore this can become simpler again.
	// key returned by an iteration might get invalidated on
	// subsequent iterations.
	Scan([]byte, bool) iter.Seq2[[]byte, []byte]

	NewBatch() Batch

	Close() error
}

type CheckCache

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

func (*CheckCache) Close

func (c *CheckCache) Close() error

func (*CheckCache) GetChunkStatus

func (c *CheckCache) GetChunkStatus(mac objects.MAC) ([]byte, error)

func (*CheckCache) GetObjectStatus

func (c *CheckCache) GetObjectStatus(mac objects.MAC) ([]byte, error)

func (*CheckCache) GetPackfileStatus

func (c *CheckCache) GetPackfileStatus(mac objects.MAC) ([]byte, error)

func (*CheckCache) GetVFSEntryStatus

func (c *CheckCache) GetVFSEntryStatus(mac objects.MAC) ([]byte, error)

func (*CheckCache) GetVFSStatus

func (c *CheckCache) GetVFSStatus(mac objects.MAC) ([]byte, error)

func (*CheckCache) PutChunkStatus

func (c *CheckCache) PutChunkStatus(mac objects.MAC, err []byte) error

func (*CheckCache) PutObjectStatus

func (c *CheckCache) PutObjectStatus(mac objects.MAC, err []byte) error

func (*CheckCache) PutPackfileStatus

func (c *CheckCache) PutPackfileStatus(mac objects.MAC, err []byte) error

func (*CheckCache) PutVFSEntryStatus

func (c *CheckCache) PutVFSEntryStatus(mac objects.MAC, err []byte) error

func (*CheckCache) PutVFSStatus

func (c *CheckCache) PutVFSStatus(mac objects.MAC, err []byte) error

type Constructor added in v1.0.10

type Constructor func(version, name, repoid string, opts Option) (Cache, error)

type DBStore

type DBStore[K any, V any] struct {
	Prefix string

	Cache *ScanCache
	// contains filtered or unexported fields
}

DBStore implements btree.Storer

func (*DBStore[K, V]) Close added in v1.0.13

func (ds *DBStore[K, V]) Close() error

func (*DBStore[K, V]) Get

func (ds *DBStore[K, V]) Get(idx int) (*btree.Node[K, int, V], error)

func (*DBStore[K, V]) Put

func (ds *DBStore[K, V]) Put(node *btree.Node[K, int, V]) (int, error)

func (*DBStore[K, V]) Update

func (ds *DBStore[K, V]) Update(idx int, node *btree.Node[K, int, V]) error

type MaintenanceCache

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

func (*MaintenanceCache) Close added in v1.0.10

func (c *MaintenanceCache) Close() error

func (*MaintenanceCache) DeleletePackfiles

func (c *MaintenanceCache) DeleletePackfiles(snapshotID objects.MAC) error

func (*MaintenanceCache) DeleteSnapshot

func (c *MaintenanceCache) DeleteSnapshot(snapshotID objects.MAC) error

func (*MaintenanceCache) GetPackfiles

func (c *MaintenanceCache) GetPackfiles(snapshotID objects.MAC) iter.Seq[objects.MAC]

func (*MaintenanceCache) HasPackfile

func (c *MaintenanceCache) HasPackfile(packfileMAC objects.MAC) bool

func (*MaintenanceCache) HasSnapshot

func (c *MaintenanceCache) HasSnapshot(snapshotID objects.MAC) (bool, error)

func (*MaintenanceCache) PutPackfile

func (c *MaintenanceCache) PutPackfile(snapshotID, packfileMAC objects.MAC) error

func (*MaintenanceCache) PutSnapshot

func (c *MaintenanceCache) PutSnapshot(snapshotID objects.MAC, data []byte) error

type Manager

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

func NewManager

func NewManager(cons Constructor) *Manager

func (*Manager) Check

func (m *Manager) Check() (*CheckCache, error)

XXX - beware that caller has responsibility to call Close() on the returned cache

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) Maintenance

func (m *Manager) Maintenance(repositoryID uuid.UUID) (*MaintenanceCache, error)

func (*Manager) Packing

func (m *Manager) Packing() (*PackingCache, error)

XXX - beware that caller has responsibility to call Close() on the returned cache

func (*Manager) Repository

func (m *Manager) Repository(repositoryID uuid.UUID) (*_RepositoryCache, error)

func (*Manager) Scan

func (m *Manager) Scan(snapshotID objects.MAC) (*ScanCache, error)

XXX - beware that caller has responsibility to call Close() on the returned cache

func (*Manager) VFS

func (m *Manager) VFS(repositoryID uuid.UUID, scheme string, origin string, deleteOnClose bool) (*VFSCache, error)

type Option added in v1.0.10

type Option int
const (
	None Option = iota

	DeleteOnClose
)

type PackingCache

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

func (*PackingCache) Close

func (c *PackingCache) Close() error

func (*PackingCache) GetIndexesBlob

func (c *PackingCache) GetIndexesBlob() iter.Seq[[]byte]

func (*PackingCache) HasBlob

func (c *PackingCache) HasBlob(Type resources.Type, mac objects.MAC) (bool, error)

func (*PackingCache) PutBlob

func (c *PackingCache) PutBlob(Type resources.Type, mac objects.MAC) error

func (*PackingCache) PutIndexBlob

func (c *PackingCache) PutIndexBlob(Type resources.Type, mac objects.MAC, data []byte) error

type SQLiteDBStore added in v1.0.13

type SQLiteDBStore[K any, V any] struct {
	// contains filtered or unexported fields
}

SQLiteDBStore implements btree.Storer

func NewSQLiteDBStore added in v1.0.13

func NewSQLiteDBStore[K, V any](storePath, storeName string) (*SQLiteDBStore[K, V], error)

func (*SQLiteDBStore[K, V]) Close added in v1.0.13

func (ds *SQLiteDBStore[K, V]) Close() error

func (*SQLiteDBStore[K, V]) Get added in v1.0.13

func (ds *SQLiteDBStore[K, V]) Get(idx int) (*btree.Node[K, int, V], error)

func (*SQLiteDBStore[K, V]) Put added in v1.0.13

func (ds *SQLiteDBStore[K, V]) Put(node *btree.Node[K, int, V]) (int, error)

func (*SQLiteDBStore[K, V]) Update added in v1.0.13

func (ds *SQLiteDBStore[K, V]) Update(idx int, node *btree.Node[K, int, V]) error

type ScanBatch added in v1.0.10

type ScanBatch struct {
	Batch
}

func (*ScanBatch) PutDelta added in v1.0.10

func (c *ScanBatch) PutDelta(blobType resources.Type, blobCsum, packfile objects.MAC, data []byte) error

func (*ScanBatch) PutDirectory added in v1.0.10

func (c *ScanBatch) PutDirectory(source int, directory string, data []byte) error

func (*ScanBatch) PutFile added in v1.0.10

func (c *ScanBatch) PutFile(source int, file string, data []byte) error

type ScanCache

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

func (*ScanCache) Close

func (c *ScanCache) Close() error

func (*ScanCache) DelDeleted

func (c *ScanCache) DelDeleted(blobType resources.Type, blobCsum objects.MAC) error

func (*ScanCache) DelDelta

func (c *ScanCache) DelDelta(blobType resources.Type, blobCsum, packfileMAC objects.MAC) error

func (*ScanCache) DelPackfile

func (c *ScanCache) DelPackfile(packfile objects.MAC) error

func (*ScanCache) DelState

func (c *ScanCache) DelState(stateID objects.MAC) error

func (*ScanCache) EnumerateKeysWithPrefix

func (c *ScanCache) EnumerateKeysWithPrefix(prefix string, reverse bool) iter.Seq2[string, []byte]

func (*ScanCache) GetConfiguration

func (c *ScanCache) GetConfiguration(key string) ([]byte, error)

func (*ScanCache) GetConfigurations

func (c *ScanCache) GetConfigurations() iter.Seq[[]byte]

func (*ScanCache) GetDeleteds

func (c *ScanCache) GetDeleteds() iter.Seq2[objects.MAC, []byte]

func (*ScanCache) GetDeletedsByType

func (c *ScanCache) GetDeletedsByType(blobType resources.Type) iter.Seq2[objects.MAC, []byte]

func (*ScanCache) GetDelta

func (c *ScanCache) GetDelta(blobType resources.Type, blobCsum objects.MAC) iter.Seq2[objects.MAC, []byte]

func (*ScanCache) GetDeltas

func (c *ScanCache) GetDeltas() iter.Seq2[objects.MAC, []byte]

func (*ScanCache) GetDeltasByType

func (c *ScanCache) GetDeltasByType(blobType resources.Type) iter.Seq2[objects.MAC, []byte]

func (*ScanCache) GetDirectory

func (c *ScanCache) GetDirectory(source int, directory string) ([]byte, error)

func (*ScanCache) GetFile

func (c *ScanCache) GetFile(source int, file string) ([]byte, error)

func (*ScanCache) GetPackfiles

func (c *ScanCache) GetPackfiles() iter.Seq2[objects.MAC, []byte]

func (*ScanCache) GetState

func (c *ScanCache) GetState(stateID objects.MAC) ([]byte, error)

func (*ScanCache) GetStates

func (c *ScanCache) GetStates() (map[objects.MAC][]byte, error)

func (*ScanCache) HasDeleted

func (c *ScanCache) HasDeleted(blobType resources.Type, blobCsum objects.MAC) (bool, error)

func (*ScanCache) HasPackfile

func (c *ScanCache) HasPackfile(packfile objects.MAC) (bool, error)

func (*ScanCache) HasState

func (c *ScanCache) HasState(stateID objects.MAC) (bool, error)

func (*ScanCache) NewBatch added in v1.0.10

func (c *ScanCache) NewBatch() StateBatch

func (*ScanCache) NewScanBatch added in v1.0.10

func (c *ScanCache) NewScanBatch() *ScanBatch

func (*ScanCache) PutConfiguration

func (c *ScanCache) PutConfiguration(key string, data []byte) error

func (*ScanCache) PutDeleted

func (c *ScanCache) PutDeleted(blobType resources.Type, blobCsum objects.MAC, data []byte) error

func (*ScanCache) PutDelta

func (c *ScanCache) PutDelta(blobType resources.Type, blobCsum, packfile objects.MAC, data []byte) error

func (*ScanCache) PutDirectory

func (c *ScanCache) PutDirectory(source int, directory string, data []byte) error

func (*ScanCache) PutFile

func (c *ScanCache) PutFile(source int, file string, data []byte) error

func (*ScanCache) PutPackfile

func (c *ScanCache) PutPackfile(packfile objects.MAC, data []byte) error

func (*ScanCache) PutState

func (c *ScanCache) PutState(stateID objects.MAC, data []byte) error

type StateBatch added in v1.0.10

type StateBatch interface {
	Batch
	PutDelta(blobType resources.Type, blobCsum, packfile objects.MAC, data []byte) error
}

type StateCache

type StateCache interface {
	PutState(stateID objects.MAC, data []byte) error
	HasState(stateID objects.MAC) (bool, error)
	GetState(stateID objects.MAC) ([]byte, error)
	DelState(stateID objects.MAC) error
	GetStates() (map[objects.MAC][]byte, error)

	PutDelta(blobType resources.Type, blobCsum, packfile objects.MAC, data []byte) error
	GetDelta(blobType resources.Type, blobCsum objects.MAC) iter.Seq2[objects.MAC, []byte]
	GetDeltasByType(blobType resources.Type) iter.Seq2[objects.MAC, []byte]
	GetDeltas() iter.Seq2[objects.MAC, []byte]
	DelDelta(blobType resources.Type, blobCsum objects.MAC, packfileMAC objects.MAC) error

	PutDeleted(blobType resources.Type, blobCsum objects.MAC, data []byte) error
	HasDeleted(blobType resources.Type, blobCsum objects.MAC) (bool, error)
	DelDeleted(blobType resources.Type, blobCsum objects.MAC) error
	GetDeletedsByType(blobType resources.Type) iter.Seq2[objects.MAC, []byte]
	GetDeleteds() iter.Seq2[objects.MAC, []byte]

	PutPackfile(packfile objects.MAC, data []byte) error
	DelPackfile(packfile objects.MAC) error
	HasPackfile(packfile objects.MAC) (bool, error)
	GetPackfiles() iter.Seq2[objects.MAC, []byte]

	PutConfiguration(key string, data []byte) error
	GetConfiguration(key string) ([]byte, error)
	GetConfigurations() iter.Seq[[]byte]

	NewBatch() StateBatch
}

type VFSCache

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

func (*VFSCache) Close

func (c *VFSCache) Close() error

func (*VFSCache) GetCachedPath added in v1.0.3

func (c *VFSCache) GetCachedPath(pathname string) ([]byte, error)

func (*VFSCache) PutCachedPath added in v1.0.3

func (c *VFSCache) PutCachedPath(pathname string, data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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