Documentation ¶
Index ¶
- Constants
- func UUIDSliceToArr(id []byte) [16]byte
- type CacheItem
- type CephCache
- type CephSegment
- type CephStorageProvider
- func (sp *CephStorageProvider) CreateDatabase(opts map[string]string) error
- func (sp *CephStorageProvider) Initialize(opts map[string]string)
- func (sp *CephStorageProvider) LockSegment(uuid []byte) bprovider.Segment
- func (sp *CephStorageProvider) Read(uuid []byte, address uint64, buffer []byte) []byte
Constants ¶
const ADDR_LOCK_SIZE = 0x1000000000
4096 blocks per addr lock
const ADDR_OBJ_SIZE = 0x0001000000
const MAX_EXPECTED_OBJECT_SIZE = 20485
Just over the DBSIZE
const METADATA_BASE = 0xFF00000000000000
We know we won't get any addresses here, because this is the relocation base as well
const NUM_RHANDLES = 200
const OFFSET_MASK = 0xFFFFFF
const RADOS_CACHE_SIZE = NUM_RHANDLES * 2
The number of RADOS blocks to cache (up to 16MB each, probably only 1.6MB each)
const R_ADDRMASK = ^((uint64(1) << 20) - 1)
We are caching 1MB blocks for read, so the address should have the bottom 20 bits clear
const R_CHUNKSIZE = 1 << 20
const R_OFFSETMASK = (uint64(1) << 20) - 1
const SEGCACHE_SIZE = 1024
const WCACHE_SIZE = 1 << 20
1MB for write cache, I doubt we will ever hit this tbh
const WORTH_CACHING = OFFSET_MASK - MAX_EXPECTED_OBJECT_SIZE
This is how many uuid/address pairs we will keep to facilitate appending to segments instead of creating new ones.
Variables ¶
This section is empty.
Functions ¶
func UUIDSliceToArr ¶
Types ¶
type CephSegment ¶
type CephSegment struct {
// contains filtered or unexported fields
}
func (*CephSegment) BaseAddress ¶
func (seg *CephSegment) BaseAddress() uint64
Returns the address of the first free word in the segment when it was locked
func (*CephSegment) Flush ¶
func (seg *CephSegment) Flush()
Block until all writes are complete. Note this does not imply a flush of the underlying files.
func (*CephSegment) Unlock ¶
func (seg *CephSegment) Unlock()
Unlocks the segment for the StorageProvider to give to other consumers Implies a flush
type CephStorageProvider ¶
type CephStorageProvider struct {
// contains filtered or unexported fields
}
func (*CephStorageProvider) CreateDatabase ¶
func (sp *CephStorageProvider) CreateDatabase(opts map[string]string) error
Called to create the database for the first time
func (*CephStorageProvider) Initialize ¶
func (sp *CephStorageProvider) Initialize(opts map[string]string)
Called at startup of a normal run
func (*CephStorageProvider) LockSegment ¶
func (sp *CephStorageProvider) LockSegment(uuid []byte) bprovider.Segment
Lock a segment, or block until a segment can be locked Returns a Segment struct Implicit unchecked assumption: you cannot lock more than one segment for a given uuid (without unlocking them in between). It will break segcache