Versions in this module Expand all Collapse all v0 v0.7.6 Jun 15, 2024 Changes in this version + const DBFileName + const DefaultFlushTimeout + const MaxBlockSize + const MaxSizeError + const UnitsGB + const UnitsKB + const UnitsMB + func AppendData(ctx context.Context, blockId string, name string, p []byte) (int, error) + func CloseDB() + func DeleteBlock(ctx context.Context, blockId string) error + func DeleteBlockFromDB(ctx context.Context, blockId string) error + func DeleteCacheEntry(ctx context.Context, blockId string, name string) + func DeleteFile(ctx context.Context, blockId string, name string) error + func DeleteFileFromDB(ctx context.Context, blockId string, name string) error + func FlushCache(ctx context.Context) error + func GetAllBlockIds(ctx context.Context) []string + func GetAllBlockIdsInDB(ctx context.Context) ([]string, error) + func GetAllBlockSizes(dataBlocks []*CacheBlock) (int, int) + func GetCacheFromDB(ctx context.Context, blockId string, name string, off int64, length int64, ...) (*[]byte, error) + func GetCacheId(blockId string, name string) string + func GetClockString(t time.Time) string + func GetDB(ctx context.Context) (*sqlx.DB, error) + func GetDBName() string + func GetMigrateVersion(m *migrate.Migrate) (uint, bool, error) + func GetValuesFromCacheId(cacheId string) (blockId string, name string) + func InsertFileIntoDB(ctx context.Context, fileInfo FileInfo) error + func MakeBlockstoreMigrate() (*migrate.Migrate, error) + func MakeFile(ctx context.Context, blockId string, name string, meta FileMeta, ...) error + func MigrateBlockstore() error + func ReadAt(ctx context.Context, blockId string, name string, p *[]byte, off int64) (int, error) + func ReadFromCacheBlock(ctx context.Context, blockId string, name string, block *CacheBlock, p *[]byte, ...) (int, error) + func SetCacheEntry(ctx context.Context, cacheId string, cacheEntry *CacheEntry) + func SetFlushTimeout(newTimeout time.Duration) + func StartFlushTimer(ctx context.Context) + func WithTx(ctx context.Context, fn func(tx *TxWrap) error) error + func WithTxRtn[RT any](ctx context.Context, fn func(tx *TxWrap) (RT, error)) (RT, error) + func WriteAt(ctx context.Context, blockId string, name string, p []byte, off int64) (int, error) + func WriteAtHelper(ctx context.Context, blockId string, name string, p []byte, off int64, ...) (int, error) + func WriteDataBlockToDB(ctx context.Context, blockId string, name string, index int, data []byte) error + func WriteFile(ctx context.Context, blockId string, name string, meta FileMeta, ...) (int, error) + func WriteFileToDB(ctx context.Context, fileInfo FileInfo) error + func WriteMeta(ctx context.Context, blockId string, name string, meta FileMeta) error + func WriteToCacheBlockNum(ctx context.Context, blockId string, name string, p []byte, pos int, ...) (int64, int, error) + func WriteToCacheBuf(buf *[]byte, p []byte, pos int, length int, maxWrite int64) (int, error) + type BlockStore interface + AppendData func(ctx context.Context, blockId string, name string, p []byte) (int, error) + CollapseIJson func(ctx context.Context, blockId string, name string) error + DeleteBlock func(ctx context.Context, blockId string) error + DeleteFile func(ctx context.Context, blockId string, name string) error + FlushCache func(ctx context.Context) error + GetAllBlockIds func(ctx context.Context) []string + ListFiles func(ctx context.Context, blockId string) []*FileInfo + MakeFile func(ctx context.Context, blockId string, name string, meta FileMeta, ...) error + ReadAt func(ctx context.Context, blockId string, name string, p *[]byte, off int64) (int, error) + Stat func(ctx context.Context, blockId string, name string) (FileInfo, error) + WriteAt func(ctx context.Context, blockId string, name string, p []byte, off int64) (int, error) + WriteFile func(ctx context.Context, blockId string, name string, meta FileMeta, ...) (int, error) + WriteMeta func(ctx context.Context, blockId string, name string, meta FileMeta) error + type CacheBlock struct + func GetCacheBlock(ctx context.Context, blockId string, name string, cacheNum int, ...) (*CacheBlock, error) + type CacheEntry struct + CacheTs int64 + DataBlocks []*CacheBlock + Info *FileInfo + Lock *sync.Mutex + Refs int64 + func GetCacheEntry(ctx context.Context, blockId string, name string) (*CacheEntry, bool) + func GetCacheEntryOrPopulate(ctx context.Context, blockId string, name string) (*CacheEntry, error) + func MakeCacheEntry(info *FileInfo) *CacheEntry + func (c *CacheEntry) DecRefs() + func (c *CacheEntry) IncRefs() + type FileInfo struct + BlockId string + CreatedTs int64 + Meta FileMeta + ModTs int64 + Name string + Opts FileOptsType + Size int64 + func DeepCopyFileInfo(fInfo *FileInfo) *FileInfo + func GetAllFilesInDB(ctx context.Context) ([]*FileInfo, error) + func GetAllFilesInDBForBlockId(ctx context.Context, blockId string) ([]*FileInfo, error) + func GetFileInfo(ctx context.Context, blockId string, name string) (*FileInfo, error) + func ListAllFiles(ctx context.Context) []*FileInfo + func ListFiles(ctx context.Context, blockId string) []*FileInfo + func Stat(ctx context.Context, blockId string, name string) (*FileInfo, error) + func (f *FileInfo) ToMap() map[string]interface{} + func (fInfo *FileInfo) FromMap(m map[string]interface{}) bool + type FileMeta = map[string]any + type FileOptsType struct + Circular bool + IJson bool + MaxSize int64 + type SingleConnDBGetter struct + SingleConnLock *sync.Mutex + func (dbg *SingleConnDBGetter) GetDB(ctx context.Context) (*sqlx.DB, error) + func (dbg *SingleConnDBGetter) ReleaseDB(db *sqlx.DB) + type TxWrap = txwrap.TxWrap