cachedblobstore

package
v0.0.0-...-7570391 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const RecordOpenHandleStackTraceForDebugging = false

Variables

View Source
var CacheSyncerGracePeriod = 1 * time.Second // only modified from test
View Source
var DisableAutoSyncForTesting = false

Functions

func SetupAutoReduceCache

func SetupAutoReduceCache(cbs *CachedBlobStore, r *scheduler.RepetitiveJobRunner, highwm, lowwm int64) scheduler.ID

Types

type AutoReduceCacheTask

type AutoReduceCacheTask struct {
	CBS           *CachedBlobStore
	HighWatermark int64
	LowWatermark  int64
}

func (AutoReduceCacheTask) Run

func (AutoReduceCacheTask) String

func (t AutoReduceCacheTask) String() string

type CacheEntryState

type CacheEntryState int
const (
	CacheEntryUninitialized CacheEntryState = iota
	CacheEntryInvalidating
	CacheEntryErrored
	CacheEntryErroredClosed
	CacheEntryClean
	CacheEntryWriteInProgress
	CacheEntryWritebackInProgress
	CacheEntryStaleWritebackInProgress
	CacheEntryDirty
	CacheEntryDirtyClosing
	CacheEntryClosing
	CacheEntryClosed
)

func (CacheEntryState) NeedsSync

func (s CacheEntryState) NeedsSync() bool

func (CacheEntryState) ShouldBeListed

func (s CacheEntryState) ShouldBeListed() bool

func (CacheEntryState) String

func (s CacheEntryState) String() string

type CacheSyncer

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

func NewCacheSyncer

func NewCacheSyncer(provider SyncCandidatesProvider, numWorkers int) *CacheSyncer

func (*CacheSyncer) Quit

func (cs *CacheSyncer) Quit()

func (*CacheSyncer) StarvingWorkerCount

func (cs *CacheSyncer) StarvingWorkerCount() int

func (*CacheSyncer) SyncAll

func (cs *CacheSyncer) SyncAll(ss []util.Syncer) error

type CacheUsageStats

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

func NewCacheUsageStats

func NewCacheUsageStats() *CacheUsageStats

func (*CacheUsageStats) FindLeastUsed

func (s *CacheUsageStats) FindLeastUsed() []string

func (*CacheUsageStats) ImportBlobList

func (s *CacheUsageStats) ImportBlobList(blobpaths []string)

func (*CacheUsageStats) ObserveOpen

func (s *CacheUsageStats) ObserveOpen(blobpath string, flags int)

func (*CacheUsageStats) ObserveRemoveBlob

func (s *CacheUsageStats) ObserveRemoveBlob(blobpath string)

func (*CacheUsageStats) View

type CacheUsageStatsView

type CacheUsageStatsView struct {
	NumEntries int `json:"num_entries"`
}

type CachedBackendVersion

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

func NewCachedBackendVersion

func NewCachedBackendVersion(backendbs blobstore.BlobStore, queryVersion version.QueryFunc) *CachedBackendVersion

func (*CachedBackendVersion) Delete

func (cbv *CachedBackendVersion) Delete(blobpath string)

func (*CachedBackendVersion) Query

func (cbv *CachedBackendVersion) Query(blobpath string) (version.Version, error)

func (*CachedBackendVersion) RestoreStateFromBlobstore

func (cbv *CachedBackendVersion) RestoreStateFromBlobstore(c *btncrypt.Cipher, bs blobstore.RandomAccessBlobStore) error

func (*CachedBackendVersion) SaveStateToBlobstore

func (cbv *CachedBackendVersion) SaveStateToBlobstore(c *btncrypt.Cipher, bs blobstore.RandomAccessBlobStore) error

func (*CachedBackendVersion) Set

func (cbv *CachedBackendVersion) Set(blobpath string, ver version.Version)

type CachedBlobEntriesManager

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

func NewCachedBlobEntriesManager

func NewCachedBlobEntriesManager() *CachedBlobEntriesManager

func (*CachedBlobEntriesManager) CloseEntryForTesting

func (mgr *CachedBlobEntriesManager) CloseEntryForTesting(blobpath string)

func (*CachedBlobEntriesManager) DropCacheEntry

func (mgr *CachedBlobEntriesManager) DropCacheEntry(blobpath string, cbs *CachedBlobStore, blobremover blobstore.BlobRemover) (err error)

func (*CachedBlobEntriesManager) DumpEntriesInfo

func (mgr *CachedBlobEntriesManager) DumpEntriesInfo() (infos []*CachedBlobEntryInfo)

func (*CachedBlobEntriesManager) FindAllSyncable

func (mgr *CachedBlobEntriesManager) FindAllSyncable() (scs []util.Syncer)

func (*CachedBlobEntriesManager) FindSyncCandidates

func (mgr *CachedBlobEntriesManager) FindSyncCandidates(n int) (scs []util.Syncer)

func (*CachedBlobEntriesManager) ListBlobs

func (mgr *CachedBlobEntriesManager) ListBlobs() (bpaths []string)

func (*CachedBlobEntriesManager) OpenEntry

func (mgr *CachedBlobEntriesManager) OpenEntry(blobpath string, cbs *CachedBlobStore) (be *CachedBlobEntry, err error)

func (*CachedBlobEntriesManager) Quit

func (mgr *CachedBlobEntriesManager) Quit()

func (*CachedBlobEntriesManager) RemoveBlob

func (mgr *CachedBlobEntriesManager) RemoveBlob(blobpath string) (err error)

func (*CachedBlobEntriesManager) Run

func (mgr *CachedBlobEntriesManager) Run()

type CachedBlobEntry

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

func NewCachedBlobEntry

func NewCachedBlobEntry(blobpath string, cbs *CachedBlobStore) *CachedBlobEntry

func (*CachedBlobEntry) BlobPath

func (be *CachedBlobEntry) BlobPath() string

func (*CachedBlobEntry) Close

func (be *CachedBlobEntry) Close(mode CloseMode) error

func (*CachedBlobEntry) CloseHandle

func (be *CachedBlobEntry) CloseHandle(bh *CachedBlobHandle)

func (*CachedBlobEntry) CloseWithLogErr

func (be *CachedBlobEntry) CloseWithLogErr(mode CloseMode)

func (*CachedBlobEntry) Info

func (*CachedBlobEntry) InitializeForTesting

func (be *CachedBlobEntry) InitializeForTesting(state CacheEntryState, lastWrite, lastSync time.Time)

func (*CachedBlobEntry) LastSync

func (be *CachedBlobEntry) LastSync() time.Time

func (*CachedBlobEntry) LastWrite

func (be *CachedBlobEntry) LastWrite() time.Time

func (*CachedBlobEntry) OpenHandle

func (be *CachedBlobEntry) OpenHandle(flags int) (*CachedBlobHandle, error)

func (*CachedBlobEntry) PRead

func (be *CachedBlobEntry) PRead(p []byte, offset int64) error

func (*CachedBlobEntry) PWrite

func (be *CachedBlobEntry) PWrite(p []byte, offset int64) error

func (*CachedBlobEntry) ShouldBeListed

func (be *CachedBlobEntry) ShouldBeListed() bool

func (*CachedBlobEntry) Size

func (be *CachedBlobEntry) Size() int64

func (*CachedBlobEntry) String

func (be *CachedBlobEntry) String() string

func (*CachedBlobEntry) Sync

func (be *CachedBlobEntry) Sync() error

func (*CachedBlobEntry) Truncate

func (be *CachedBlobEntry) Truncate(newsize int64) error

type CachedBlobEntryInfo

type CachedBlobEntryInfo struct {
	BlobPath              string    `json:"blobpath"`
	State                 string    `json:"state"`
	BlobLen               int64     `json:"blob_len"`
	ValidLen              int64     `json:"valid_len"`
	SyncCount             int       `json:"sync_count"`
	LastUsed              time.Time `json:"last_used"`
	LastWrite             time.Time `json:"last_write"`
	LastSync              time.Time `json:"last_sync"`
	NumberOfWriterHandles int       `json:"number_of_writer_handles"`
	NumberOfHandles       int       `json:"number_of_handles"`
}

type CachedBlobHandle

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

func (*CachedBlobHandle) Close

func (bh *CachedBlobHandle) Close() error

func (*CachedBlobHandle) Flags

func (bh *CachedBlobHandle) Flags() int

func (*CachedBlobHandle) PRead

func (bh *CachedBlobHandle) PRead(p []byte, offset int64) error

func (*CachedBlobHandle) PWrite

func (bh *CachedBlobHandle) PWrite(p []byte, offset int64) error

func (*CachedBlobHandle) Size

func (bh *CachedBlobHandle) Size() int64

func (*CachedBlobHandle) String

func (bh *CachedBlobHandle) String() string

func (*CachedBlobHandle) Sync

func (bh *CachedBlobHandle) Sync() error

func (*CachedBlobHandle) Truncate

func (bh *CachedBlobHandle) Truncate(newsize int64) error

type CachedBlobStore

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

func New

func New(backendbs blobstore.BlobStore, cachebs blobstore.RandomAccessBlobStore, s *scheduler.Scheduler, flags int, queryVersion version.QueryFunc) (*CachedBlobStore, error)

func (*CachedBlobStore) CloseEntryForTesting

func (cbs *CachedBlobStore) CloseEntryForTesting(blobpath string)

func (*CachedBlobStore) DumpEntriesInfo

func (cbs *CachedBlobStore) DumpEntriesInfo() []*CachedBlobEntryInfo

func (*CachedBlobStore) Flags

func (cbs *CachedBlobStore) Flags() int

func (*CachedBlobStore) ImplName

func (*CachedBlobStore) ImplName() string

func (*CachedBlobStore) ListBlobs

func (cbs *CachedBlobStore) ListBlobs() ([]string, error)

func (*CachedBlobStore) Open

func (cbs *CachedBlobStore) Open(blobpath string, flags int) (blobstore.BlobHandle, error)

func (*CachedBlobStore) OpenReader

func (cbs *CachedBlobStore) OpenReader(blobpath string) (io.ReadCloser, error)

func (*CachedBlobStore) OpenWriter

func (cbs *CachedBlobStore) OpenWriter(blobpath string) (io.WriteCloser, error)

func (*CachedBlobStore) Quit

func (cbs *CachedBlobStore) Quit() error

func (*CachedBlobStore) ReduceCache

func (cbs *CachedBlobStore) ReduceCache(ctx context.Context, desiredSize int64, dryrun bool) error

func (*CachedBlobStore) RemoveBlob

func (cbs *CachedBlobStore) RemoveBlob(blobpath string) error

func (*CachedBlobStore) RestoreState

func (cbs *CachedBlobStore) RestoreState(c *btncrypt.Cipher) error

func (*CachedBlobStore) SaveState

func (cbs *CachedBlobStore) SaveState(c *btncrypt.Cipher) error

func (*CachedBlobStore) Sync

func (cbs *CachedBlobStore) Sync() error

type CloseMode

type CloseMode int

type InvalidateCacheTask

type InvalidateCacheTask struct {
	BE *CachedBlobEntry
}

func (*InvalidateCacheTask) ImplName

func (*InvalidateCacheTask) ImplName() string

func (*InvalidateCacheTask) Run

func (*InvalidateCacheTask) String

func (t *InvalidateCacheTask) String() string

type InvalidateFailedErr

type InvalidateFailedErr struct {
	Blobpath string
}

func (InvalidateFailedErr) Error

func (e InvalidateFailedErr) Error() string

type ReduceCacheTask

type ReduceCacheTask struct {
	CBS         *CachedBlobStore
	DesiredSize int64
	DryRun      bool
}

func (*ReduceCacheTask) Run

type SaveStateTask

type SaveStateTask struct {
	CBS *CachedBlobStore
	C   *btncrypt.Cipher
}

func (SaveStateTask) Run

func (SaveStateTask) String

func (t SaveStateTask) String() string

type SyncCandidatesProvider

type SyncCandidatesProvider interface {
	FindSyncCandidates(int) []util.Syncer
}

Jump to

Keyboard shortcuts

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