caching

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: ISC Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const CACHE_VERSION = "2.0.0"

Variables

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

Functions

func MakeKeyUpperBound

func MakeKeyUpperBound(key []byte) []byte

func MakePrefixIterIterOptions

func MakePrefixIterIterOptions(prefix []byte) *pebble.IterOptions

Types

type CheckCache

type CheckCache struct {
	*PebbleCache
	// 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 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]) 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 {
	*PebbleCache
	// contains filtered or unexported fields
}

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(cacheDir string) *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 NoopLoggerAndTracer

type NoopLoggerAndTracer struct{}

Lifter from internal/logger pebble.

func (NoopLoggerAndTracer) Errorf

func (l NoopLoggerAndTracer) Errorf(format string, args ...interface{})

func (NoopLoggerAndTracer) Eventf

func (l NoopLoggerAndTracer) Eventf(ctx context.Context, format string, args ...interface{})

func (NoopLoggerAndTracer) Fatalf

func (l NoopLoggerAndTracer) Fatalf(format string, args ...interface{})

func (NoopLoggerAndTracer) Infof

func (l NoopLoggerAndTracer) Infof(format string, args ...interface{})

func (NoopLoggerAndTracer) IsTracingEnabled

func (l NoopLoggerAndTracer) IsTracingEnabled(ctx context.Context) bool

type PackingCache

type PackingCache struct {
	*PebbleCache
	// 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 PebbleCache

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

func New

func New(dir string) (*PebbleCache, error)

func (*PebbleCache) Close

func (p *PebbleCache) Close() error

type ScanCache

type ScanCache struct {
	*PebbleCache
	// 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) 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 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]
}

type VFSCache

type VFSCache struct {
	*PebbleCache
	// 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