Documentation
¶
Index ¶
- Constants
- type Block
- func (block *Block) Clone() *Block
- func (block *Block) Delete(at uint64, count uint64)
- func (block *Block) Insert(at uint64, rawBytes []byte)
- func (block *Block) Iterator(reverse bool) Iterator
- func (block *Block) LastActivity() uint64
- func (block *Block) MarshalJSON() ([]byte, error)
- func (block *Block) Squash(count uint64) *Block
- func (block *Block) UnmarshalJSON(data []byte) error
- type Document
- func (doc *Document) Bytes() []byte
- func (doc *Document) Delete(at uint64, count uint64) *Document
- func (doc *Document) Each(evalFunc func(current Iterator) bool) *Document
- func (doc *Document) FromBytes(compressed []byte) (err error)
- func (doc *Document) Insert(at uint64, rawBytes []byte) *Document
- func (doc *Document) Open(filename string) (err error)
- func (doc *Document) Save(filename string) (err error)
- func (doc *Document) String() string
- func (doc *Document) Write(file io.Writer) (int, error)
- type ForwardIterator
- type Iterator
- type JSONOperation
- type MetaType
- type ReverseIterator
- func (it *ReverseIterator) AffectedArea() uint64
- func (it *ReverseIterator) GetMeta(metaType MetaType) uint64
- func (it *ReverseIterator) HasNext() bool
- func (it *ReverseIterator) Init()
- func (it *ReverseIterator) Meta() []uint64
- func (it *ReverseIterator) PointInTime() uint64
- func (it *ReverseIterator) Retain() uint64
- func (it *ReverseIterator) Type() uint64
- func (it *ReverseIterator) Value() []byte
- type Shard
Constants ¶
View Source
const ( // Will Insert N runes at position OpInsert = 0 // Will Delete N runes at position OpDelete = 1 )
View Source
const MetaSize = 5
The size of our Meta
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
func (*Block) LastActivity ¶
func (*Block) MarshalJSON ¶
func (*Block) UnmarshalJSON ¶
type Document ¶
type Document struct { Title string `json:"title"` Operations Block `json:"ops"` Meta map[string]string `json:"meta"` }
func NewDocument ¶
func NewDocument() Document
func (*Document) Bytes ¶
Bytes returns a slice of length b.Len() holding the end result of our operations
type ForwardIterator ¶
type ForwardIterator struct {
// contains filtered or unexported fields
}
func (*ForwardIterator) GetMeta ¶
func (it *ForwardIterator) GetMeta(metaType MetaType) uint64
func (*ForwardIterator) HasNext ¶
func (it *ForwardIterator) HasNext() bool
func (*ForwardIterator) Init ¶
func (it *ForwardIterator) Init()
func (*ForwardIterator) Meta ¶
func (it *ForwardIterator) Meta() []uint64
func (*ForwardIterator) Value ¶
func (it *ForwardIterator) Value() []byte
type JSONOperation ¶
type MetaType ¶
type MetaType uint64
const ( // Where data is stored in our slice, index of []byte MetaDataIndex MetaType = iota // How many runes this action will affect (i.e. for DeleteOp, how many runes we will delete) // For InsertOp, the size of our data in bytes (used for keeping data in the slice) MetaDataByteSize // The type of our operation Delete or Insert MetaOperation // How many runes to skip MetaRetain // When was the action triggered, used for sorting and keeping data integrity MetaTimestamp )
type ReverseIterator ¶
type ReverseIterator struct {
// contains filtered or unexported fields
}
func (*ReverseIterator) AffectedArea ¶
func (it *ReverseIterator) AffectedArea() uint64
func (*ReverseIterator) GetMeta ¶
func (it *ReverseIterator) GetMeta(metaType MetaType) uint64
func (*ReverseIterator) HasNext ¶
func (it *ReverseIterator) HasNext() bool
func (*ReverseIterator) Init ¶
func (it *ReverseIterator) Init()
func (*ReverseIterator) Meta ¶
func (it *ReverseIterator) Meta() []uint64
func (*ReverseIterator) PointInTime ¶
func (it *ReverseIterator) PointInTime() uint64
func (*ReverseIterator) Retain ¶
func (it *ReverseIterator) Retain() uint64
func (*ReverseIterator) Type ¶
func (it *ReverseIterator) Type() uint64
func (*ReverseIterator) Value ¶
func (it *ReverseIterator) Value() []byte
type Shard ¶
type Shard struct {
// contains filtered or unexported fields
}
func (*Shard) Get ¶
Get returns two things, the meta value and a boolean if the value was found. If the index overflows our slice, it will return 0 and false
func (*Shard) IsEmpty ¶
IsEmpty asserts whether we have 0 actions or not in our shard. I.E. An empty Batch will return 0
Click to show internal directories.
Click to hide internal directories.