Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Trie is an implementation of Ternary Search Tries to store XID to UID map. It uses Arena to allocate nodes in the trie. It is not thread-safe.
func NewTrie ¶
func NewTrie() *Trie
NewTrie would return back a Trie backed by the provided Arena. Trie would assume ownership of the Arena. Release must be called at the end to release Arena's resources.
func (*Trie) Get ¶
Get would return the UID for the key. If the key is not found, it would return 0.
type XidMap ¶
type XidMap struct {
// contains filtered or unexported fields
}
XidMap allocates and tracks mappings between Xids and Uids in a threadsafe manner. It's memory friendly because the mapping is stored on disk, but fast because it uses an LRU cache.
func New ¶
func New(opts XidMapOptions) *XidMap
New creates an XidMap. zero conn must be valid for UID allocations to happen. Optionally, a badger.DB can be provided to persist the xid to uid allocations. This would add latency to the assignment operations. XidMap creates the temporary buffers inside dir directory. The caller must ensure that the dir exists.
func (*XidMap) AllocateUid ¶
AllocateUid gives a single uid without creating an xid to uid mapping.
func (*XidMap) AssignUid ¶
AssignUid creates new or looks up existing XID to UID mappings. It also returns if UID was created.
func (*XidMap) BumpTo ¶
BumpTo can be used to make Zero allocate UIDs up to this given number. Attempts are made to ensure all future allocations of UIDs be higher than this one, but results are not guaranteed.
type XidMapOptions ¶
type XidMapOptions struct {
UidAssigner *grpc.ClientConn
DgClient *dgo.Dgraph
DB *badger.DB
Dir string
}
XidMapOptions specifies the options for creating a new xidmap.