Skip to content

Commit

Permalink
M trie/nodes.pb.go
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Nov 24, 2020
1 parent 59f68a6 commit 45c826e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 63 deletions.
82 changes: 34 additions & 48 deletions trie/nodes.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions trie/nodes.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ message VLenArray {
// Since 0.5.10
message Nodes {

// WithPrefixContent indicates whether full inner prefixes are stored or only the
// lengths of inner prefix are stored.
//
// Since 0.5.10
bool WithPrefixContent = 9;

// BigInnerCnt is number of big (267 bit) inner node.
//
// Since 0.5.10
Expand Down
4 changes: 2 additions & 2 deletions trie/slimtrie.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ type Opt struct {
CompleteLeaf bool

// Complete tells SlimTrie to store complete keys content.
// This option implies "WithPrefixContent" and "WithLeafPrefix".
// This option implies "CompleteInner" and "CompleteLeaf".
// With this option there is no false positive and SlimTrie works just like
// a static key-value map.
//
Expand Down Expand Up @@ -179,7 +179,7 @@ func (st *SlimTrie) content() []string {
ns := st.nodes
rst = append(rst, fmt.Sprintf(`InnerBM: %+v`, bitmap.ToArray(ns.NodeTypeBM.Words)))
rst = append(rst, fmt.Sprintf(`StepBM: %+v`, bitmap.ToArray(ns.InnerPrefixes.PresenceBM.Words)))
if ns.WithPrefixContent {
if ns.InnerPrefixes.PositionBM != nil {
rst = append(rst, fmt.Sprintf(`PrefixStarts: %+v`, bitmap.ToArray(ns.InnerPrefixes.PositionBM.Words)))
} else {
rst = append(rst, fmt.Sprintf(`Steps: %+v`, ns.InnerPrefixLens))
Expand Down
11 changes: 5 additions & 6 deletions trie/slimtrie_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,11 @@ func (c *creator) build(e encode.Encoder) *SlimTrie {
_ = shortCnt

ns := &Nodes{
ShortSize: shortSize,
ShortMask: bitmap.Mask[shortSize],
ShortMinusInner: shortSize - innerSize,
BigInnerOffset: (bigInnerSize - innerSize) * c.bigCnt,
BigInnerCnt: c.bigCnt,
WithPrefixContent: c.option.CompleteInner,
ShortSize: shortSize,
ShortMask: bitmap.Mask[shortSize],
ShortMinusInner: shortSize - innerSize,
BigInnerOffset: (bigInnerSize - innerSize) * c.bigCnt,
BigInnerCnt: c.bigCnt,
}

// Mapping most used 17-bit bitmap inner node to short inner node.
Expand Down
2 changes: 1 addition & 1 deletion trie/slimtrie_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func (st *SlimTrie) getInner(nodeid int32, qr *querySession) {
inn := ns.InnerPrefixes.PresenceBM
ithPref := rank128(inn.Words, inn.RankIndex, ithInner)

if ns.WithPrefixContent {
if ns.InnerPrefixes.PositionBM != nil {

// stored actual prefix of a node.
ps := ns.InnerPrefixes.PositionBM
Expand Down

0 comments on commit 45c826e

Please sign in to comment.