Documentation ¶
Index ¶
- Constants
- Variables
- type Data
- type Group
- type IdxVersion0
- func (*IdxVersion0) Descriptor() ([]byte, []int)deprecated
- func (x *IdxVersion0) GetCrc32() uint32
- func (x *IdxVersion0) GetKey() int64
- func (x *IdxVersion0) GetOffset() int64
- func (x *IdxVersion0) GetSize() int32
- func (x *IdxVersion0) GetTimeout() int64
- func (*IdxVersion0) ProtoMessage()
- func (x *IdxVersion0) ProtoReflect() protoreflect.Message
- func (x *IdxVersion0) Reset()
- func (x *IdxVersion0) String() string
- type Index
- type IndexInMemory
- type Size
- type Storage
- type Storager
Constants ¶
View Source
const ( KB Size = 1024 MB = KB * 1024 GB = MB * 1024 TB = 1024 * GB )
Variables ¶
View Source
var ( ErrIllegalKey = errors.New("Illegal key") ErrDirName = errors.New("dir name is empty") )
View Source
var (
ErrFull = errors.New("The space is full")
)
View Source
var File_storage_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type IdxVersion0 ¶
type IdxVersion0 struct { Key int64 `protobuf:"varint,1,opt,name=key,proto3" json:"key,omitempty"` //返回给客户端的值 Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` //大小 Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` //偏移量 Timeout int64 `protobuf:"varint,4,opt,name=timeout,proto3" json:"timeout,omitempty"` //超时时间 Crc32 uint32 `protobuf:"varint,5,opt,name=crc32,proto3" json:"crc32,omitempty"` //crc32校验和 // contains filtered or unexported fields }
索引的数据结构 完整的索引,还有payload(放在第一位)和crc32(第在最后一位)
func (*IdxVersion0) Descriptor
deprecated
func (*IdxVersion0) Descriptor() ([]byte, []int)
Deprecated: Use IdxVersion0.ProtoReflect.Descriptor instead.
func (*IdxVersion0) GetCrc32 ¶
func (x *IdxVersion0) GetCrc32() uint32
func (*IdxVersion0) GetKey ¶
func (x *IdxVersion0) GetKey() int64
func (*IdxVersion0) GetOffset ¶
func (x *IdxVersion0) GetOffset() int64
func (*IdxVersion0) GetSize ¶
func (x *IdxVersion0) GetSize() int32
func (*IdxVersion0) GetTimeout ¶
func (x *IdxVersion0) GetTimeout() int64
func (*IdxVersion0) ProtoMessage ¶
func (*IdxVersion0) ProtoMessage()
func (*IdxVersion0) ProtoReflect ¶
func (x *IdxVersion0) ProtoReflect() protoreflect.Message
func (*IdxVersion0) Reset ¶
func (x *IdxVersion0) Reset()
func (*IdxVersion0) String ¶
func (x *IdxVersion0) String() string
type Index ¶
type Index struct { Key int32 `protobuf:"varint,1,opt,name=key,proto3" json:"key,omitempty"` //返回给客户端的值 Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` //大小 Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` //偏移量 Timeout int64 `protobuf:"varint,4,opt,name=timeout,proto3" json:"timeout,omitempty"` //超时时间 Crc32 uint32 `protobuf:"varint,5,opt,name=crc32,proto3" json:"crc32,omitempty"` //crc32校验和 }
type IndexInMemory ¶
type IndexInMemory struct {
// contains filtered or unexported fields
}
一个内存索引管理32GB文件
func (*IndexInMemory) Get ¶
func (i *IndexInMemory) Get(key int64) (element Data, ok bool, err error)
获取
func (*IndexInMemory) GetSeq ¶
func (i *IndexInMemory) GetSeq() (key int64)
Click to show internal directories.
Click to hide internal directories.