Documentation ¶
Index ¶
- Constants
- Variables
- func SetupAutoReduceCache(cbs *CachedBlobStore, r *scheduler.RepetitiveJobRunner, highwm, lowwm int64) scheduler.ID
- type AutoReduceCacheTask
- type CacheEntryState
- type CacheSyncer
- type CacheUsageStats
- type CacheUsageStatsView
- type CachedBackendVersion
- func (cbv *CachedBackendVersion) Delete(blobpath string)
- func (cbv *CachedBackendVersion) Query(blobpath string) (version.Version, error)
- func (cbv *CachedBackendVersion) RestoreStateFromBlobstore(c *btncrypt.Cipher, bs blobstore.RandomAccessBlobStore) error
- func (cbv *CachedBackendVersion) SaveStateToBlobstore(c *btncrypt.Cipher, bs blobstore.RandomAccessBlobStore) error
- func (cbv *CachedBackendVersion) Set(blobpath string, ver version.Version)
- type CachedBlobEntriesManager
- func (mgr *CachedBlobEntriesManager) CloseEntryForTesting(blobpath string)
- func (mgr *CachedBlobEntriesManager) DropCacheEntry(blobpath string, cbs *CachedBlobStore, blobremover blobstore.BlobRemover) (err error)
- func (mgr *CachedBlobEntriesManager) DumpEntriesInfo() (infos []*CachedBlobEntryInfo)
- func (mgr *CachedBlobEntriesManager) FindAllSyncable() (scs []util.Syncer)
- func (mgr *CachedBlobEntriesManager) FindSyncCandidates(n int) (scs []util.Syncer)
- func (mgr *CachedBlobEntriesManager) ListBlobs() (bpaths []string)
- func (mgr *CachedBlobEntriesManager) OpenEntry(blobpath string, cbs *CachedBlobStore) (be *CachedBlobEntry, err error)
- func (mgr *CachedBlobEntriesManager) Quit()
- func (mgr *CachedBlobEntriesManager) RemoveBlob(blobpath string) (err error)
- func (mgr *CachedBlobEntriesManager) Run()
- type CachedBlobEntry
- func (be *CachedBlobEntry) BlobPath() string
- func (be *CachedBlobEntry) Close(mode CloseMode) error
- func (be *CachedBlobEntry) CloseHandle(bh *CachedBlobHandle)
- func (be *CachedBlobEntry) CloseWithLogErr(mode CloseMode)
- func (be *CachedBlobEntry) Info() *CachedBlobEntryInfo
- func (be *CachedBlobEntry) InitializeForTesting(state CacheEntryState, lastWrite, lastSync time.Time)
- func (be *CachedBlobEntry) LastSync() time.Time
- func (be *CachedBlobEntry) LastWrite() time.Time
- func (be *CachedBlobEntry) OpenHandle(flags int) (*CachedBlobHandle, error)
- func (be *CachedBlobEntry) PRead(p []byte, offset int64) error
- func (be *CachedBlobEntry) PWrite(p []byte, offset int64) error
- func (be *CachedBlobEntry) ShouldBeListed() bool
- func (be *CachedBlobEntry) Size() int64
- func (be *CachedBlobEntry) String() string
- func (be *CachedBlobEntry) Sync() error
- func (be *CachedBlobEntry) Truncate(newsize int64) error
- type CachedBlobEntryInfo
- type CachedBlobHandle
- func (bh *CachedBlobHandle) Close() error
- func (bh *CachedBlobHandle) Flags() int
- func (bh *CachedBlobHandle) PRead(p []byte, offset int64) error
- func (bh *CachedBlobHandle) PWrite(p []byte, offset int64) error
- func (bh *CachedBlobHandle) Size() int64
- func (bh *CachedBlobHandle) String() string
- func (bh *CachedBlobHandle) Sync() error
- func (bh *CachedBlobHandle) Truncate(newsize int64) error
- type CachedBlobStore
- func (cbs *CachedBlobStore) CloseEntryForTesting(blobpath string)
- func (cbs *CachedBlobStore) DumpEntriesInfo() []*CachedBlobEntryInfo
- func (cbs *CachedBlobStore) Flags() int
- func (*CachedBlobStore) ImplName() string
- func (cbs *CachedBlobStore) ListBlobs() ([]string, error)
- func (cbs *CachedBlobStore) Open(blobpath string, flags int) (blobstore.BlobHandle, error)
- func (cbs *CachedBlobStore) OpenReader(blobpath string) (io.ReadCloser, error)
- func (cbs *CachedBlobStore) OpenWriter(blobpath string) (io.WriteCloser, error)
- func (cbs *CachedBlobStore) Quit() error
- func (cbs *CachedBlobStore) ReduceCache(ctx context.Context, desiredSize int64, dryrun bool) error
- func (cbs *CachedBlobStore) RemoveBlob(blobpath string) error
- func (cbs *CachedBlobStore) RestoreState(c *btncrypt.Cipher) error
- func (cbs *CachedBlobStore) SaveState(c *btncrypt.Cipher) error
- func (cbs *CachedBlobStore) Sync() error
- type CloseMode
- type InvalidateCacheTask
- type InvalidateFailedErr
- type ReduceCacheTask
- type SaveStateTask
- type SyncCandidatesProvider
Constants ¶
View Source
const RecordOpenHandleStackTraceForDebugging = false
Variables ¶
View Source
var CacheSyncerGracePeriod = 1 * time.Second // only modified from test
View Source
var DisableAutoSyncForTesting = false
View Source
var PrometheusRegisterer prometheus.Registerer = prometheus.DefaultRegisterer
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 (t AutoReduceCacheTask) Run(ctx context.Context) scheduler.Result
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
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 ¶
func (s *CacheUsageStats) View() CacheUsageStatsView
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
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 (be *CachedBlobEntry) Info() *CachedBlobEntryInfo
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) 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) 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 (*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 (*CachedBlobStore) RemoveBlob ¶
func (cbs *CachedBlobStore) RemoveBlob(blobpath string) error
func (*CachedBlobStore) RestoreState ¶
func (cbs *CachedBlobStore) RestoreState(c *btncrypt.Cipher) error
func (*CachedBlobStore) Sync ¶
func (cbs *CachedBlobStore) Sync() error
type InvalidateCacheTask ¶
type InvalidateCacheTask struct {
BE *CachedBlobEntry
}
func (*InvalidateCacheTask) ImplName ¶
func (*InvalidateCacheTask) ImplName() string
func (*InvalidateCacheTask) Run ¶
func (t *InvalidateCacheTask) Run(ctx context.Context) scheduler.Result
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 }
type SaveStateTask ¶
type SaveStateTask struct { CBS *CachedBlobStore C *btncrypt.Cipher }
func (SaveStateTask) String ¶
func (t SaveStateTask) String() string
type SyncCandidatesProvider ¶
Click to show internal directories.
Click to hide internal directories.