Documentation ¶
Index ¶
- func CanObserve() bool
- func CanResume() bool
- func DelShmByKey(key uint32) error
- func Exist(key uint32) error
- func GetShmBytesByKey(key uint32) (uint64, error)
- type BucketHead
- type BucketUnit
- type Segment
- func (seg *Segment) Attach() error
- func (seg *Segment) Detach()
- func (seg *Segment) GetBucketUnit(hindex uint16, uindex uint32) (*BucketUnit, error)
- func (seg *Segment) Load(hindex uint16, uindex uint32) ([]byte, error)
- func (seg *Segment) Observe(cb1 func(*SegmentHead), cb2 func(uint16, *BucketHead), ...) error
- func (seg *Segment) Reset(cb1 func(*SegmentHead), cb2 func(uint16, *BucketHead), ...) error
- func (seg *Segment) Resume(cb1 func(*SegmentHead), cb2 func(uint16, *BucketHead), ...) error
- func (seg *Segment) Save(hindex uint16, uindex uint32, data []byte) error
- type SegmentDs
- type SegmentHead
- type SegmentOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetShmBytesByKey ¶
GetShmBytesByKey - get shm bytes by the key
Types ¶
type BucketHead ¶
type BucketHead struct {
// contains filtered or unexported fields
}
BucketHead - the bucket head
func (*BucketHead) GetBytes ¶
func (head *BucketHead) GetBytes() uint32
GetBytes - get bucket head bytes field for unit cap
func (*BucketHead) GetCount ¶
func (head *BucketHead) GetCount() uint32
GetCount - get bucket head count field for unit num
type BucketUnit ¶
type BucketUnit struct {
// contains filtered or unexported fields
}
BucketUnit - the bucket unit of array
func (*BucketUnit) GetLen ¶
func (unit *BucketUnit) GetLen() uint32
GetLen - get data length for unit
func (*BucketUnit) GetReadSlice ¶
func (unit *BucketUnit) GetReadSlice() []byte
GetReadSlice - get the slice to read
func (*BucketUnit) GetWriteSlice ¶
func (unit *BucketUnit) GetWriteSlice() []byte
GetWriteSlice - get the slice to write
func (*BucketUnit) SetLen ¶
func (unit *BucketUnit) SetLen(len uint32)
SetLen - set data length for unit
type Segment ¶
type Segment struct {
// contains filtered or unexported fields
}
Segment - the segment of shm
func NewSegment ¶
NewSegment - new a shm segemnt
func NewSegmentWithOption ¶
func NewSegmentWithOption(key uint32, opt *SegmentOption) (*Segment, error)
NewSegmentWithOption - new a shm segment with option
func (*Segment) GetBucketUnit ¶
func (seg *Segment) GetBucketUnit(hindex uint16, uindex uint32) (*BucketUnit, error)
GetBucketUnit - get the bucket unit by index
func (*Segment) Observe ¶
func (seg *Segment) Observe(cb1 func(*SegmentHead), cb2 func(uint16, *BucketHead), cb3 func(uint16, uint32, *BucketUnit)) error
Observe - observe the segment
func (*Segment) Reset ¶
func (seg *Segment) Reset(cb1 func(*SegmentHead), cb2 func(uint16, *BucketHead), cb3 func(uint16, uint32, *BucketUnit)) error
Reset - reset the segment
func (*Segment) Resume ¶
func (seg *Segment) Resume(cb1 func(*SegmentHead), cb2 func(uint16, *BucketHead), cb3 func(uint16, uint32, *BucketUnit)) error
Resume - resume the segment
type SegmentDs ¶
SegmentDs - the segment data structure
func GetShmDsByKey ¶
GetShmDsByKey - get shm ds by the key
type SegmentHead ¶
type SegmentHead struct {
// contains filtered or unexported fields
}
SegmentHead - the segment head of shm
type SegmentOption ¶
type SegmentOption struct {
// contains filtered or unexported fields
}
SegmentOption - the segment option for new
func (*SegmentOption) AddBucket ¶
func (opt *SegmentOption) AddBucket(count uint32, bytes uint32)
AddBucket - add a bucket type
func (*SegmentOption) PrintBucket ¶
func (opt *SegmentOption) PrintBucket() string
PrintBucket - print the bucket info