Documentation ¶
Index ¶
- Constants
- Variables
- func CMerge(inputs [][]byte) (merged []byte)
- func CState(sum int64) []byte
- func ChotkiKVString(key, value []byte) string
- func EditTLV(off uint64, rdt byte, tlv []byte) (edit []byte)
- func Exists(dirname string) (bool, error)
- func FieldOffset(fields []string, name string) rdx.ID
- func LastLit(recs protocol.Records) byte
- func OKey(id rdx.ID, rdt byte) (key []byte)
- func OKeyIdRdt(key []byte) (id rdx.ID, rdt byte)
- func ObjectKeyRange(oid rdx.ID) (fro, til []byte)
- func PacketID(pack []byte) rdx.ID
- func PacketSrcSeq(pack []byte) (src, seq uint32)
- func ParseHandshake(body []byte) (mode uint64, vv rdx.VV, err error)
- func ParsePacket(pack []byte) (lit byte, id, ref rdx.ID, body []byte, err error)
- func ParseVPack(vpack []byte) (vvs map[rdx.ID]rdx.VV, err error)
- func ProbeI(input []byte) rdx.ID
- func ProbeID(lit byte, input []byte) rdx.ID
- func VKey(id rdx.ID) (key []byte)
- func VKeyId(key []byte) rdx.ID
- type CallHook
- type Chotki
- func (cho *Chotki) AddHook(fid rdx.ID, hook Hook)
- func (cho *Chotki) AddPacketHose(name string) (feed protocol.FeedCloser)
- func (cho *Chotki) AddToNField(fid rdx.ID, count uint64) (id rdx.ID, err error)
- func (cho *Chotki) ApplyC(id, ref rdx.ID, body []byte, batch *pebble.Batch) (err error)
- func (cho *Chotki) ApplyD(id, ref rdx.ID, body []byte, batch *pebble.Batch) (err error)
- func (cho *Chotki) ApplyE(id, r rdx.ID, body []byte, batch *pebble.Batch, calls *[]CallHook) (err error)
- func (cho *Chotki) ApplyH(id, ref rdx.ID, body []byte, batch *pebble.Batch) (err error)
- func (cho *Chotki) ApplyOY(lot byte, id, ref rdx.ID, body []byte, batch *pebble.Batch) (err error)
- func (cho *Chotki) ApplyV(id, ref rdx.ID, body []byte, batch *pebble.Batch) (err error)
- func (cho *Chotki) BroadcastPacket(records protocol.Records, except string)
- func (cho *Chotki) ClassFields(cid rdx.ID) (fields Fields, err error)
- func (cho *Chotki) Clock() rdx.Clock
- func (cho *Chotki) Close() error
- func (cho *Chotki) CommitPacket(lit byte, ref rdx.ID, body protocol.Records) (id rdx.ID, err error)
- func (cho *Chotki) Connect(ctx context.Context, addr string) error
- func (cho *Chotki) Database() *pebble.DB
- func (cho *Chotki) Directory() string
- func (cho *Chotki) Disconnect(addr string) error
- func (cho *Chotki) Drain(recs protocol.Records) (err error)
- func (cho *Chotki) DumpAll(writer io.Writer)
- func (cho *Chotki) DumpObjects(writer io.Writer)
- func (cho *Chotki) DumpVV(writer io.Writer)
- func (cho *Chotki) EditFieldTLV(fid rdx.ID, delta []byte) (id rdx.ID, err error)
- func (cho *Chotki) EditObject(oid rdx.ID, fields ...string) (id rdx.ID, err error)
- func (cho *Chotki) EditObjectRDX(oid rdx.ID, pairs []rdx.RDX) (id rdx.ID, err error)
- func (cho *Chotki) GetFieldTLV(id rdx.ID) (rdt byte, tlv []byte)
- func (cho *Chotki) IncNField(fid rdx.ID) (id rdx.ID, err error)
- func (cho *Chotki) Last() rdx.ID
- func (cho *Chotki) Listen(ctx context.Context, addr string) error
- func (cho *Chotki) NewClass(parent rdx.ID, fields ...Field) (id rdx.ID, err error)
- func (cho *Chotki) NewObject(tid rdx.ID, fields ...string) (id rdx.ID, err error)
- func (cho *Chotki) ObjectFieldMapTermId(fid rdx.ID) (themap rdx.MapTR, err error)
- func (cho *Chotki) ObjectFieldTLV(fid rdx.ID) (rdt byte, tlv []byte, err error)
- func (cho *Chotki) ObjectFields(oid rdx.ID) (tid rdx.ID, decl Fields, fact protocol.Records, err error)
- func (cho *Chotki) ObjectFieldsByClass(oid rdx.ID, form []string) (tid rdx.ID, tlvs protocol.Records, err error)
- func (cho *Chotki) ObjectFieldsTLV(oid rdx.ID) (tid rdx.ID, tlv protocol.Records, err error)
- func (cho *Chotki) ObjectIterator(oid rdx.ID, snap *pebble.Snapshot) *pebble.Iterator
- func (cho *Chotki) ObjectMapper() *ORM
- func (cho *Chotki) ObjectString(oid rdx.ID) (txt string, err error)
- func (cho *Chotki) RemoveAllHooks(fid rdx.ID)
- func (cho *Chotki) RemoveHook(fid rdx.ID, hook Hook) (err error)
- func (cho *Chotki) RemovePacketHose(name string) error
- func (cho *Chotki) RestoreNet(ctx context.Context) error
- func (cho *Chotki) SetFieldTLV(fid rdx.ID, tlve []byte) (id rdx.ID, err error)
- func (cho *Chotki) Snapshot() pebble.Reader
- func (cho *Chotki) Source() uint64
- func (cho *Chotki) Unlisten(addr string) error
- func (cho *Chotki) UpdateVTree(id, ref rdx.ID, pb *pebble.Batch) (err error)
- func (cho *Chotki) VersionVector() (vv rdx.VV, err error)
- type Counter64
- type Field
- type Fields
- type Hook
- type Merger
- type NativeObject
- type ORM
- func (orm *ORM) Clear() error
- func (orm *ORM) Close() error
- func (orm *ORM) Compile(name string, cid rdx.ID) (code string, err error)
- func (orm *ORM) FindID(obj NativeObject) rdx.ID
- func (orm *ORM) Load(id rdx.ID, blanc NativeObject) (obj NativeObject, err error)
- func (orm *ORM) New(cid rdx.ID, objs ...NativeObject) (err error)
- func (orm *ORM) Object(id rdx.ID) (obj NativeObject)
- func (orm *ORM) Save(objs ...NativeObject) (err error)
- func (orm *ORM) SaveAll() (err error)
- func (orm *ORM) SyncAll() (err error)
- func (orm *ORM) UpdateAll() (err error)
- func (orm *ORM) UpdateObject(obj NativeObject, snap *pebble.Snapshot) error
- type Options
- type PebbleMergeAdaptor
- type Syncer
- func (sync *Syncer) Close() error
- func (sync *Syncer) Drain(recs protocol.Records) (err error)
- func (sync *Syncer) DrainHandshake(recs protocol.Records) (err error)
- func (sync *Syncer) EndGracefully(reason error) (err error)
- func (sync *Syncer) Feed() (recs protocol.Records, err error)
- func (sync *Syncer) FeedBlockDiff() (diff protocol.Records, err error)
- func (sync *Syncer) FeedDiffVV() (vv protocol.Records, err error)
- func (sync *Syncer) FeedHandshake() (vv protocol.Records, err error)
- func (sync *Syncer) SetDrainState(state int)
- func (sync *Syncer) SetFeedState(state int)
- func (sync *Syncer) WaitDrainState(state int) (ds int)
Constants ¶
View Source
const ( IdNames = id2 + 1 IdNodes = id2 + 2 IdNodeInfo = id2 + 3 // ID from which we count user static objects IdLog1 = id2 + 4 )
View Source
const ( SyncRead = 1 SyncWrite = 2 SyncLive = 4 SyncRW = SyncRead | SyncWrite SyncRL = SyncRead | SyncLive SyncRWLive = SyncRead | SyncWrite | SyncLive )
View Source
const ( SendHandshake = iota SendDiff SendLive SendEOF SendNone )
View Source
const LidLKeyLen = 1 + 8 + 1
View Source
const SyncBlockBits = 28
View Source
const SyncBlockMask = (rdx.ID(1) << SyncBlockBits) - 1
View Source
const SyncOutQueueLimit = 1 << 20
Variables ¶
View Source
var ( ErrDbClosed = errors.New("chotki: db is closed") ErrDirnameIsFile = errors.New("chotki: the dirname is file") ErrNotImplemented = errors.New("chotki: not implemented yet") ErrHookNotFound = errors.New("chotki: hook not found") ErrBadIRecord = errors.New("chotki: bad id-ref record") ErrBadORecord = errors.New("chotki: bad id-ref record") ErrBadHPacket = errors.New("chotki: bad handshake packet") ErrBadEPacket = errors.New("chotki: bad E packet") ErrBadVPacket = errors.New("chotki: bad V packet") ErrBadYPacket = errors.New("chotki: bad Y packet") ErrBadLPacket = errors.New("chotki: bad L packet") ErrBadTPacket = errors.New("chotki: bad T packet") ErrBadOPacket = errors.New("chotki: bad O packet") ErrSrcUnknown = errors.New("chotki: source unknown") ErrSyncUnknown = errors.New("chotki: sync session unknown") ErrBadRRecord = errors.New("chotki: bad ref record") ErrClosed = errors.New("chotki: no replica open") ErrBadTypeDescription = errors.New("chotki: bad type description") ErrObjectUnknown = errors.New("chotki: unknown object") ErrTypeUnknown = errors.New("chotki: unknown object type") ErrUnknownFieldInAType = errors.New("chotki: unknown field for the type") ErrBadValueForAType = errors.New("chotki: bad value for the type") ErrBadClass = errors.New("chotki: bad class description") ErrOutOfOrder = errors.New("chotki: order fail: sequence gap") ErrCausalityBroken = errors.New("chotki: order fail: refs an unknown op") )
View Source
var ClassTemplate = `` /* 1096-byte string literal not displayed */
todo RDX formula
View Source
var ETemplate = `
func (o *{{Name}}) Get{{- Name}}() {
}
func (o *{{Name}}) Put{{- Name}}() {
}
`
todo collection description
View Source
var ErrOffsetOpId = errors.New("op id is offset")
View Source
var ErrWrongFieldType = errors.New("wrong field type")
View Source
var FIRSTnatives = map[byte]string{
'F': "float64",
'I': "int64",
'R': "rdx.ID",
'S': "string",
'T': "string",
'N': "uint64",
'Z': "int64",
}
View Source
var Log0 = protocol.Records{ protocol.Record('Y', protocol.Record('I', rdx.ID0.ZipBytes()), protocol.Record('R', rdx.ID0.ZipBytes()), protocol.Record('T', rdx.Ttlv("Name")), protocol.Record('T', rdx.Ttlv("S")), ), protocol.Record('C', protocol.Record('I', id1.ZipBytes()), protocol.Record('R', rdx.ID0.ZipBytes()), protocol.Record('T', rdx.Ttlv("Names")), protocol.Record('T', rdx.Ttlv("M")), protocol.Record('T', rdx.Ttlv("Nodes")), protocol.Record('T', rdx.Ttlv("M")), protocol.Record('T', rdx.Ttlv("NodeInfo")), protocol.Record('T', rdx.Ttlv("M")), ), protocol.Record('O', protocol.Record('I', id2.ZipBytes()), protocol.Record('R', id1.ZipBytes()), protocol.Record('M', protocol.Record('T', rdx.Ttlv("0")), protocol.Record('R', rdx.Rtlv(rdx.ID0)), protocol.Record('T', rdx.Ttlv("Global")), protocol.Record('R', rdx.Rtlv(id2)), protocol.Record('T', rdx.Ttlv("Names")), protocol.Record('R', rdx.Rtlv(IdNames)), protocol.Record('T', rdx.Ttlv("Nodes")), protocol.Record('R', rdx.Rtlv(IdNodes)), ), protocol.Record('M'), protocol.Record('M'), ), }
FORMAT: replica creation packet
View Source
var SendStates = []string{
"SendHandshake",
"SendDiff",
"SendLive",
"SendEOF",
"SendNone",
}
Functions ¶
func ChotkiKVString ¶
func ObjectKeyRange ¶
func PacketSrcSeq ¶
PacketSeqSrc picks the I field from the packet. Returns 0,0 if nothing found.
Types ¶
type Chotki ¶
type Chotki struct {
// contains filtered or unexported fields
}
TLV all the way down
func (*Chotki) AddPacketHose ¶
func (cho *Chotki) AddPacketHose(name string) (feed protocol.FeedCloser)
func (*Chotki) AddToNField ¶
func (*Chotki) BroadcastPacket ¶
func (*Chotki) ClassFields ¶
todo []Field -> map[uint64]Field
func (*Chotki) CommitPacket ¶
Here new packets are timestamped and queued for save
func (*Chotki) Disconnect ¶
func (*Chotki) DumpObjects ¶
func (*Chotki) EditFieldTLV ¶
func (*Chotki) EditObject ¶
func (*Chotki) EditObjectRDX ¶
func (*Chotki) ObjectFieldMapTermId ¶
func (*Chotki) ObjectFieldTLV ¶
func (*Chotki) ObjectFields ¶
func (*Chotki) ObjectFieldsByClass ¶
func (*Chotki) ObjectFieldsTLV ¶
func (*Chotki) ObjectIterator ¶
returns nil for "not found"
func (*Chotki) ObjectMapper ¶
func (*Chotki) RemoveAllHooks ¶
func (*Chotki) RemovePacketHose ¶
func (*Chotki) SetFieldTLV ¶
func (*Chotki) UpdateVTree ¶
type NativeObject ¶
type ORM ¶
func (*ORM) Load ¶
func (orm *ORM) Load(id rdx.ID, blanc NativeObject) (obj NativeObject, err error)
func (*ORM) Save ¶
func (orm *ORM) Save(objs ...NativeObject) (err error)
Save the object changes. Recommended, especially if you loaded many, modified few.
func (*ORM) UpdateObject ¶
func (orm *ORM) UpdateObject(obj NativeObject, snap *pebble.Snapshot) error
type Options ¶
type Options struct { pebble.Options Src uint64 Name string Log1 protocol.Records MaxLogLen int64 RelaxedOrder bool Logger utils.Logger TlsConfig *tls.Config }
func (*Options) SetDefaults ¶
func (o *Options) SetDefaults()
type PebbleMergeAdaptor ¶
type PebbleMergeAdaptor struct {
// contains filtered or unexported fields
}
func (*PebbleMergeAdaptor) MergeNewer ¶
func (a *PebbleMergeAdaptor) MergeNewer(value []byte) error
func (*PebbleMergeAdaptor) MergeOlder ¶
func (a *PebbleMergeAdaptor) MergeOlder(value []byte) error
type Syncer ¶
type Syncer struct { Host *Chotki Mode uint64 Name string Log utils.Logger // contains filtered or unexported fields }
func (*Syncer) DrainHandshake ¶
func (*Syncer) EndGracefully ¶
func (*Syncer) FeedBlockDiff ¶
func (*Syncer) SetDrainState ¶
func (*Syncer) SetFeedState ¶
func (*Syncer) WaitDrainState ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.