Documentation
¶
Index ¶
- Constants
- Variables
- func BuildChunkRecord(chunk []byte) []byte
- func CheckContainerHashFile(id int, filename, storedHash string) error
- func GetContainerMaxSize() int64
- func ReadChunkDataAt(c Container, offset int64, expectedSize int64) ([]byte, error)
- func SealContainer(tx db.DBTX, containerID int64, filename string) error
- func SetContainerMaxSize(size int64)
- func UpdateContainerSize(tx db.DBTX, containerID int64, newSize int64) error
- type ActiveContainer
- type Container
- type FileContainer
Constants ¶
View Source
const ( ChunkHashSize = 32 ChunkRecordSizeSize = 4 ChunkRecordHeaderSize = ChunkHashSize + ChunkRecordSizeSize )
View Source
const ( ContainerMagic = "ColdKeep" // must be exactly 8 bytes ContainerHdrLen = 64 // fixed header size in bytes )
View Source
const ( ContainerVersionMajor = 0 ContainerVersionMinor = 6 )
View Source
const ( FLAG_BLOCK_LAYOUT = 1 << 0 // container uses block-based layout FLAG_HAS_BLOCK_TBL = 1 << 1 // optional block index present )
Reserved future flags (not used yet)
Variables ¶
View Source
var ContainersDir = utils_env.GetenvOrDefault("COLDKEEP_STORAGE_DIR", "./storage/containers")
Functions ¶
func BuildChunkRecord ¶ added in v0.6.0
func CheckContainerHashFile ¶ added in v0.4.0
func GetContainerMaxSize ¶
func GetContainerMaxSize() int64
GetContainerMaxSize returns the current container max size
func ReadChunkDataAt ¶ added in v0.6.0
func SetContainerMaxSize ¶
func SetContainerMaxSize(size int64)
SetContainerMaxSize sets the container max size (for testing)
Types ¶
type ActiveContainer ¶ added in v0.6.0
func GetOrCreateOpenContainer ¶
func GetOrCreateOpenContainer(db db.DBTX) (ActiveContainer, error)
type FileContainer ¶ added in v0.6.0
type FileContainer struct {
// contains filtered or unexported fields
}
func OpenExistingContainer ¶ added in v0.6.0
func OpenExistingContainer(readonly bool, path string, maxSize int64) (*FileContainer, error)
func (*FileContainer) Append ¶ added in v0.6.0
func (c *FileContainer) Append(data []byte) (int64, error)
func (*FileContainer) Close ¶ added in v0.6.0
func (c *FileContainer) Close() error
func (*FileContainer) ReadAt ¶ added in v0.6.0
func (c *FileContainer) ReadAt(offset int64, size int64) ([]byte, error)
func (*FileContainer) Sync ¶ added in v0.6.0
func (c *FileContainer) Sync() error
Click to show internal directories.
Click to hide internal directories.