Documentation ¶
Overview ¶
*
- Copyright 2017 wfs Author. All Rights Reserved.
- email: donnie4w@gmail.com
Index ¶
- func Append(f *os.File, bs []byte, offset int64) (n int, err error)
- func AppendData(bs []byte, name string, fileType string, shardname string) (err error)
- func Bytes2Octal(bb []byte) (value int32)
- func Bytes2hex(bb []byte) (value int64)
- func DBDel(key []byte) (err error)
- func DBExsit(key []byte) (b bool)
- func DBPut(key, value []byte) (err error)
- func DBPutMd5Bean(md5key []byte, md5Bean Md5Bean) (err error)
- func DBPutSegment(key []byte, s Segment) (err error)
- func DelData(name string) (shardname string, err error)
- func DelSlave(name string)
- func EncodeMd5(md5 Md5Bean) (bs []byte)
- func EncodeSegment(segment Segment) (bs []byte)
- func Exsit(name string) (b bool)
- func GetData(name string) (bs []byte, shardname string, er error)
- func Hex2bytes(row int64) (bs []byte)
- func Init()
- func MD5(data []byte) []byte
- func NewHashMap() *hashmap
- func NewLruCache(maxEntries int) *lruCache
- func Octal2bytes(row int32) (bs []byte)
- func ReadAt(f *os.File, byteInt int, offset int64) (bs []byte, err error)
- func SaveSlave(name string, bs []byte)
- func SlaveList() (slavemap map[string][]byte)
- func Write(f *os.File, bs []byte) (n int, err error)
- type Fdata
- func (this *Fdata) AppendData(bs []byte) (offset int64, size int32, err error)
- func (this *Fdata) CloseAndDelete()
- func (this *Fdata) CloseFile()
- func (this *Fdata) Compact(chip int32) (finish bool)
- func (this *Fdata) FileSize() int64
- func (this *Fdata) GetAndSetCurPoint(size int64) (offset int64)
- func (this *Fdata) GetData(md5Bean *Md5Bean) (bs []byte, err error)
- func (this *Fdata) WriteIdxMd5(md5key []byte) (err error)
- type FileManager
- type LockString
- type Md5Bean
- type ReadBean
- type Segment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
----------------------------------------------------------------------------------------------------------------------
func AppendData ¶
func Bytes2Octal ¶
func DBPutMd5Bean ¶
func DBPutSegment ¶
--------------------------------------------------------------------------------------------------------------------------
func EncodeSegment ¶
func Hex2bytes ¶
--------------------------------------------------------------------------------------------------------------------
func NewHashMap ¶
func NewHashMap() *hashmap
func NewLruCache ¶
func NewLruCache(maxEntries int) *lruCache
func Octal2bytes ¶
Types ¶
type Fdata ¶
type Fdata struct { FileName string //所在文件名 CurPoint int64 //当前指针 // contains filtered or unexported fields }
func (*Fdata) AppendData ¶
func (*Fdata) CloseAndDelete ¶
func (this *Fdata) CloseAndDelete()
func (*Fdata) GetAndSetCurPoint ¶
func (*Fdata) WriteIdxMd5 ¶
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
func OpenFileManager ¶
func OpenFileManager() (f *FileManager)
func (*FileManager) DelMd5Bean ¶
func (this *FileManager) DelMd5Bean(md5key []byte)
注意这个删除并非线程安全,mk5key并发调用仍然存储相同md5值刚存储就被删除的情况 由于正常情况下出现机率极低,此处不做处理
func (*FileManager) GetFdataByName ¶
func (this *FileManager) GetFdataByName(filename string) (fdata *Fdata)
func (*FileManager) GetMd5Bean ¶
func (this *FileManager) GetMd5Bean(md5key []byte) (mb *Md5Bean)
type LockString ¶
type LockString struct {
// contains filtered or unexported fields
}
func (*LockString) Lock ¶
func (this *LockString) Lock(s string)
func (*LockString) UnLock ¶
func (this *LockString) UnLock(s string)
type Md5Bean ¶
type Md5Bean struct { Offset int64 //文件所在位置 Size int32 //文件大小 字节 FileName string //所在文件名 QuoteNum int32 //引用数 Sequence []byte //文件序号 Compress bool //是否压缩 }
func Byte2Md5Bean ¶
func DBGetMd5Bean ¶
func DecoderMd5 ¶
-------------------------------------------------
func NewMd5Bean ¶
type Segment ¶
type Segment struct { Id int64 //文件ID号 Name string //文件名 FileType string //文件类型 Md5 []byte //文件md5值 ShardName string }
func Bytes2Segment ¶
func DBGetSegment ¶
func DecoderSegment ¶
--------------------------------------------------------------------------------------------------------------------
Click to show internal directories.
Click to hide internal directories.