Documentation ¶
Overview ¶
Package dal is a generated protocol buffer package.
It is generated from these files:
dal/protobuf.proto
It has these top-level messages:
ProtoLog ProtoSegment ProtoFact
Index ¶
- func DeleteBlock(e storage.Tx, domain string, id *uuid.UUID, idx int) error
- func DeleteLog(e storage.Tx, domain string, name string) error
- func DeleteSegment(e storage.Tx, domain string, id *uuid.UUID) error
- func GetBlock(e storage.Tx, domain string, id *uuid.UUID, idx int) ([]byte, error)
- func SetBlock(e storage.Tx, domain string, id *uuid.UUID, idx int, bytes []byte) (int, error)
- func SetLog(e storage.Tx, domain string, log *Log) (int, error)
- func SetSegment(e storage.Tx, domain string, segment *Segment) (int, error)
- type BlockDecoder
- type BlockEncoder
- type Log
- type ProtoFact
- func (m *ProtoFact) GetAdded() bool
- func (m *ProtoFact) GetAttribute() string
- func (m *ProtoFact) GetAttributeDomain() string
- func (m *ProtoFact) GetEntity() string
- func (m *ProtoFact) GetEntityDomain() string
- func (m *ProtoFact) GetTime() int64
- func (m *ProtoFact) GetValue() string
- func (m *ProtoFact) GetValueDomain() string
- func (*ProtoFact) ProtoMessage()
- func (m *ProtoFact) Reset()
- func (m *ProtoFact) String() string
- type ProtoLog
- type ProtoSegment
- func (m *ProtoSegment) GetBase() []byte
- func (m *ProtoSegment) GetBlocks() int32
- func (m *ProtoSegment) GetBytes() int32
- func (m *ProtoSegment) GetCount() int32
- func (m *ProtoSegment) GetNext() []byte
- func (m *ProtoSegment) GetTime() int64
- func (m *ProtoSegment) GetTransaction() uint64
- func (m *ProtoSegment) GetUUID() []byte
- func (*ProtoSegment) ProtoMessage()
- func (m *ProtoSegment) Reset()
- func (m *ProtoSegment) String() string
- type Segment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBlock ¶
GetBlock returns a block from storage. The lookup requires the domain, ID of the segment the block is contained in, the index of the block in the segment, and the transaction that processed the segment.
Types ¶
type BlockDecoder ¶
type BlockDecoder struct { Domain string Transaction uint64 Count int // contains filtered or unexported fields }
BlockDecoder decodes bytes into facts.
func NewBlockDecoder ¶
func NewBlockDecoder(block []byte, domain string, tx uint64) *BlockDecoder
func (*BlockDecoder) Empty ¶
func (d *BlockDecoder) Empty() bool
func (*BlockDecoder) Err ¶
func (d *BlockDecoder) Err() error
func (*BlockDecoder) Next ¶
func (d *BlockDecoder) Next() *origins.Fact
type BlockEncoder ¶
type BlockEncoder struct { Count int // contains filtered or unexported fields }
BlockEncoder encodes facts into a buffer.
func NewBlockEncoder ¶
func NewBlockEncoder() *BlockEncoder
func (*BlockEncoder) Bytes ¶
func (e *BlockEncoder) Bytes() []byte
Bytes returns the unread slice of encoded bytes.
func (*BlockEncoder) Reset ¶
func (e *BlockEncoder) Reset()
Reset resets the internal buffer and sets the count to zero.
type Log ¶
type Log struct { // Name of the log. Currently, only the "commit" log is in use. Name string // Domain the log is created in. Domain string // ID of the segment that is the head of the log. Head *uuid.UUID }
A Log represents a chain of segments with the log maintaining a pointer to the most recent segment in the chain.
type ProtoFact ¶
type ProtoFact struct { Added *bool `protobuf:"varint,1,req" json:"Added,omitempty"` EntityDomain *string `protobuf:"bytes,2,req" json:"EntityDomain,omitempty"` Entity *string `protobuf:"bytes,3,req" json:"Entity,omitempty"` AttributeDomain *string `protobuf:"bytes,4,req" json:"AttributeDomain,omitempty"` Attribute *string `protobuf:"bytes,5,req" json:"Attribute,omitempty"` ValueDomain *string `protobuf:"bytes,6,opt" json:"ValueDomain,omitempty"` Value *string `protobuf:"bytes,7,req" json:"Value,omitempty"` Time *int64 `protobuf:"varint,8,opt" json:"Time,omitempty"` XXX_unrecognized []byte `json:"-"` }
Facts do not contain omit the domain and transaction ID since this info is contained in the tiers accessed above the fact. Specifically, the domain is required to access the fact, so it is attached to the fact when decoded. Likewise, the the transaction ID is referenced by the segment that is accessed prior to decoding facts. The fact operation is currently encoded as a boolean where true denotes "assert" and false denotes "retract".
func (*ProtoFact) GetAttribute ¶
func (*ProtoFact) GetAttributeDomain ¶
func (*ProtoFact) GetEntityDomain ¶
func (*ProtoFact) GetValueDomain ¶
func (*ProtoFact) ProtoMessage ¶
func (*ProtoFact) ProtoMessage()
type ProtoLog ¶
type ProtoLog struct { Head []byte `protobuf:"bytes,1,opt" json:"Head,omitempty"` XXX_unrecognized []byte `json:"-"` }
A log is the header of a linked list of segments. It is one of the few mutable values since it holds the pointer to the head of the linked list. Upon a successful transaction, the head is updated to point to the most segment.
func (*ProtoLog) ProtoMessage ¶
func (*ProtoLog) ProtoMessage()
type ProtoSegment ¶
type ProtoSegment struct { UUID []byte `protobuf:"bytes,1,req" json:"UUID,omitempty"` Transaction *uint64 `protobuf:"varint,2,req" json:"Transaction,omitempty"` Time *int64 `protobuf:"varint,3,req" json:"Time,omitempty"` Blocks *int32 `protobuf:"varint,4,req" json:"Blocks,omitempty"` Count *int32 `protobuf:"varint,5,req" json:"Count,omitempty"` Bytes *int32 `protobuf:"varint,6,req" json:"Bytes,omitempty"` Next []byte `protobuf:"bytes,7,opt" json:"Next,omitempty"` Base []byte `protobuf:"bytes,8,opt" json:"Base,omitempty"` XXX_unrecognized []byte `json:"-"` }
A segment behaves as a node in a linked list in the scope of a domain. It corresponds to a transaction and maintains stats about contained facts. To access the facts, the segment key is combined with a block index, e.g segment.1.0 which translates to "segment 1 block 0".
func (*ProtoSegment) GetBase ¶
func (m *ProtoSegment) GetBase() []byte
func (*ProtoSegment) GetBlocks ¶
func (m *ProtoSegment) GetBlocks() int32
func (*ProtoSegment) GetBytes ¶
func (m *ProtoSegment) GetBytes() int32
func (*ProtoSegment) GetCount ¶
func (m *ProtoSegment) GetCount() int32
func (*ProtoSegment) GetNext ¶
func (m *ProtoSegment) GetNext() []byte
func (*ProtoSegment) GetTime ¶
func (m *ProtoSegment) GetTime() int64
func (*ProtoSegment) GetTransaction ¶
func (m *ProtoSegment) GetTransaction() uint64
func (*ProtoSegment) GetUUID ¶
func (m *ProtoSegment) GetUUID() []byte
func (*ProtoSegment) ProtoMessage ¶
func (*ProtoSegment) ProtoMessage()
func (*ProtoSegment) Reset ¶
func (m *ProtoSegment) Reset()
func (*ProtoSegment) String ¶
func (m *ProtoSegment) String() string
type Segment ¶
type Segment struct { // Unique identifier of the segment. UUID *uuid.UUID // ID of the transaction this segment was created in. Transaction uint64 // The domain this segment corresponds to. Domain string // Time the segment was committed. Time time.Time // Number of blocks in this segment. Blocks int // Total number of facts in the segment. Count int // Total number of bytes of the segment take up. Bytes int // ID of the segment that acted as the basis for this one. This // is defined as the time the transaction starts. Base *uuid.UUID // ID of the segment that this segment succeeds. Typically this is // the same value as Base, except when a conflict is resolved and // the segment position is changed. Next *uuid.UUID }
Segment represents a transacted set of facts. Segments are broken up into fixed-sized blocks to facilitate flushing the data to disk during a long-running transaction. Each segment maintains the basis