Documentation ¶
Index ¶
- Constants
- Variables
- func IdxFileEntry(bytes []byte) (key uint64, offset uint32, size uint32)
- func ParseKeyHash(key_hash_string string) (uint64, uint32, error)
- func ParseUpload(r *http.Request) (fileName string, data []byte, mimeType string, pairMap map[string]string, ...)
- func WalkIndexFile(r *os.File, fn func(key uint64, offset, size uint32) error) error
- type Block
- type CompactMap
- type CompactSection
- type Key
- type Mapper
- type Needle
- func (n *Needle) Append(w io.Writer, vers version.Version) (size uint32, actualSize int64, err error)
- func (n *Needle) Etag() string
- func (n *Needle) HasLastModifiedDate() bool
- func (n *Needle) HasMime() bool
- func (n *Needle) HasName() bool
- func (n *Needle) HasPairs() bool
- func (n *Needle) HasTtl() bool
- func (n *Needle) IsGzipped() bool
- func (n *Needle) ParseHeader(byte []byte)
- func (n *Needle) ParsePath(fid string) (err error)
- func (n *Needle) ReadData(r *os.File, offset int64, size uint32, vers version.Version) (err error)
- func (n *Needle) ReleaseMemory()
- func (n *Needle) SetGzipped()
- func (n *Needle) SetHasLastModifiedDate()
- func (n *Needle) SetHasMime()
- func (n *Needle) SetHasName()
- func (n *Needle) SetHasPairs()
- func (n *Needle) SetHasTtl()
- type NeedleMap
- func (nm *NeedleMap) Close()
- func (nm *NeedleMap) Delete(key uint64, offset uint32) error
- func (nm *NeedleMap) Destroy() error
- func (nm *NeedleMap) Get(key uint64) (element *NeedleValue, ok bool)
- func (nm *NeedleMap) IndexFileContent() ([]byte, error)
- func (nm *NeedleMap) IndexFileName() string
- func (nm *NeedleMap) IndexFileSize() uint64
- func (nm *NeedleMap) Put(key uint64, offset uint32, size uint32) error
- type NeedleValue
- type NeedleValueMap
Constants ¶
View Source
const ( HeaderSize = 16 //should never change this PaddingSize = 8 ChecksumSize = 4 MaxPossibleVolumeSize = 4 * 1024 * 1024 * 1024 * 8 TombstoneFileSize = math.MaxUint32 PairNamePrefix = "Seaweed-" IndexSize = 16 FlagGzip = 0x01 FlagHasName = 0x02 FlagHasMime = 0x04 FlagHasLastModifiedDate = 0x08 FlagHasTtl = 0x10 FlagHasPairs = 0x20 FlagIsChunkManifest = 0x80 LastModifiedBytesLength = 5 TtlBytesLength = 2 )
View Source
const (
RowsToRead = 1024
)
Variables ¶
View Source
var (
EnableBytesCache = true
)
Functions ¶
func ParseUpload ¶
Types ¶
type CompactMap ¶
type CompactMap struct {
// contains filtered or unexported fields
}
This map assumes mostly inserting increasing keys
func NewCompactMap ¶
func NewCompactMap() *CompactMap
func (*CompactMap) Delete ¶
func (cm *CompactMap) Delete(key Key) uint32
func (*CompactMap) Get ¶
func (cm *CompactMap) Get(key Key) (*NeedleValue, bool)
func (*CompactMap) Set ¶
func (cm *CompactMap) Set(key Key, offset, size uint32) (oldOffset, oldSize uint32)
func (*CompactMap) Visit ¶
func (cm *CompactMap) Visit(visit func(NeedleValue) error) error
Visit visits all entries or stop if any error when visiting
type CompactSection ¶
func NewCompactSection ¶
func NewCompactSection(start Key) *CompactSection
func (*CompactSection) Delete ¶
func (cs *CompactSection) Delete(key Key) uint32
return old entry size
func (*CompactSection) Get ¶
func (cs *CompactSection) Get(key Key) (*NeedleValue, bool)
type Mapper ¶
type Mapper interface { Put(key uint64, offset uint32, size uint32) error Get(key uint64) (element *NeedleValue, ok bool) Delete(key uint64, offset uint32) error Close() Destroy() error ContentSize() uint64 DeletedSize() uint64 FileCount() int DeletedCount() int MaxFileKey() uint64 IndexFileSize() uint64 IndexFileContent() ([]byte, error) IndexFileName() string }
type Needle ¶
type Needle struct { Cookie uint32 `comment:"random number to mitigate brute force lookups"` Id uint64 `comment:"needle id"` Size uint32 `comment:"sum of DataSize,Data,NameSize,Name,MimeSize,Mime"` DataSize uint32 `comment:"Data size"` //version2 Data []byte `comment:"The actual file data"` Flags byte `comment:"boolean flags"` //version2 NameSize uint8 //version2 Name []byte `comment:"maximum 256 characters"` //version2 MimeSize uint8 //version2 Mime []byte `comment:"maximum 256 characters"` //version2 PairsSize uint16 //version2 Pairs []byte `comment:"additional name value pairs, json format, maximum 64kB"` LastModified uint64 //only store LastModifiedBytesLength bytes, which is 5 bytes to disk Ttl *ttl.TTL Checksum crc.CRC `comment:"CRC32 to check integrity"` Padding []byte `comment:"Aligned to 8 bytes"` // contains filtered or unexported fields }
* A Needle means a uploaded and stored file. * Needle file size is limited to 4GB for now.
func (*Needle) HasLastModifiedDate ¶
func (*Needle) ParseHeader ¶
func (*Needle) ReleaseMemory ¶
func (n *Needle) ReleaseMemory()
func (*Needle) SetGzipped ¶
func (n *Needle) SetGzipped()
func (*Needle) SetHasLastModifiedDate ¶
func (n *Needle) SetHasLastModifiedDate()
func (*Needle) SetHasMime ¶
func (n *Needle) SetHasMime()
func (*Needle) SetHasName ¶
func (n *Needle) SetHasName()
func (*Needle) SetHasPairs ¶
func (n *Needle) SetHasPairs()
type NeedleMap ¶
type NeedleMap struct {
// contains filtered or unexported fields
}
func NewCompactNeedleMap ¶
func (*NeedleMap) IndexFileContent ¶
func (*NeedleMap) IndexFileName ¶
func (nm *NeedleMap) IndexFileName() string
func (*NeedleMap) IndexFileSize ¶
func (nm *NeedleMap) IndexFileSize() uint64
type NeedleValue ¶
type NeedleValueMap ¶
Click to show internal directories.
Click to hide internal directories.