Documentation ¶
Index ¶
- Constants
- Variables
- func GetActualSize(size uint32, version Version) int64
- func NeedleBodyLength(needleSize uint32, version Version) int64
- func PaddingLength(needleSize uint32, version Version) uint32
- func ParseNeedleIdCookie(key_hash_string string) (NeedleId, Cookie, error)
- func ReadNeedleBlob(r *os.File, offset int64, size uint32, version Version) (dataSlice []byte, err error)
- type CRC
- type FileId
- type Needle
- func (n *Needle) Append(w *os.File, version Version) (offset uint64, size uint32, actualSize int64, err error)
- func (n *Needle) DiskSize(version Version) int64
- 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) IsChunkedManifest() bool
- func (n *Needle) IsGzipped() bool
- func (n *Needle) LastModifiedString() string
- func (n *Needle) MD5() string
- func (n *Needle) ParseNeedleHeader(bytes []byte)
- func (n *Needle) ParsePath(fid string) (err error)
- func (n *Needle) ReadBytes(bytes []byte, offset int64, size uint32, version Version) (err error)
- func (n *Needle) ReadData(r *os.File, offset int64, size uint32, version Version) (err error)
- func (n *Needle) ReadNeedleBody(r *os.File, version Version, offset int64, bodyLength int64) (bytes []byte, err error)
- func (n *Needle) ReadNeedleBodyBytes(needleBody []byte, version Version) (err error)
- func (n *Needle) SetGzipped()
- func (n *Needle) SetHasLastModifiedDate()
- func (n *Needle) SetHasMime()
- func (n *Needle) SetHasName()
- func (n *Needle) SetHasPairs()
- func (n *Needle) SetHasTtl()
- func (n *Needle) SetIsChunkManifest()
- func (n *Needle) String() (str string)
- type TTL
- type Version
- type VolumeId
Constants ¶
View Source
const ( NeedleChecksumSize = 4 PairNamePrefix = "Seaweed-" )
View Source
const ( FlagGzip = 0x01 FlagHasName = 0x02 FlagHasMime = 0x04 FlagHasLastModifiedDate = 0x08 FlagHasTtl = 0x10 FlagHasPairs = 0x20 FlagIsChunkManifest = 0x80 LastModifiedBytesLength = 5 TtlBytesLength = 2 )
View Source
const ( //stored unit types Empty byte = iota Minute Hour Day Week Month Year )
View Source
const ( Version1 = Version(1) Version2 = Version(2) Version3 = Version(3) CurrentVersion = Version3 )
Variables ¶
View Source
var EMPTY_TTL = &TTL{}
Functions ¶
func GetActualSize ¶
func NeedleBodyLength ¶
func PaddingLength ¶
func ParseNeedleIdCookie ¶
Types ¶
type FileId ¶
type FileId struct { VolumeId VolumeId Key NeedleId Cookie Cookie }
func NewFileIdFromNeedle ¶
func ParseFileIdFromString ¶
Deserialize the file id
func (*FileId) GetNeedleId ¶
func (n *FileId) GetNeedleId() NeedleId
func (*FileId) GetNeedleIdCookie ¶
func (*FileId) GetVolumeId ¶
type Needle ¶
type Needle struct { Cookie Cookie `comment:"random number to mitigate brute force lookups"` Id NeedleId `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 Checksum CRC `comment:"CRC32 to check integrity"` AppendAtNs uint64 `comment:"append timestamp in nano seconds"` //version3 Padding []byte `comment:"Aligned to 8 bytes"` }
* A Needle means a uploaded and stored file. * Needle file size is limited to 4GB for now.
func CreateNeedleFromRequest ¶
func ReadNeedleHeader ¶
func (*Needle) HasLastModifiedDate ¶
func (*Needle) IsChunkedManifest ¶
func (*Needle) LastModifiedString ¶
func (*Needle) ParseNeedleHeader ¶
func (*Needle) ReadBytes ¶
ReadBytes hydrates the needle from the bytes buffer, with only n.Id is set.
func (*Needle) ReadNeedleBody ¶
func (n *Needle) ReadNeedleBody(r *os.File, version Version, offset int64, bodyLength int64) (bytes []byte, err error)
n should be a needle already read the header the input stream will read until next file entry
func (*Needle) ReadNeedleBodyBytes ¶
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()
func (*Needle) SetIsChunkManifest ¶
func (n *Needle) SetIsChunkManifest()
Click to show internal directories.
Click to hide internal directories.