-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the purpose of path hints? #7
Comments
Ok. I'll try to put together some documentation on the README. |
I added a PATH_HINT markdown file. |
The benchmark code helped me understand the API, it wasn't clear to me prior to reading that that the functions using path hints mutated the hint |
I wonder if this API would be helpful: type PathContext struct {
bt *BTree
hint PathHint
}
func (c *PathContext) Delete(key interface{}) interface{} {
return c.bt.DeleteHint(key, &c.hint)
}
func (c *PathContext) Get(key interface{}) interface{} {
return c.bt.GetHint(key, &c.hint)
}
func (c *PathContext) Set(key interface{}) interface{} {
return c.bt.SetHint(key, &c.hint)
}
func main() {
bt := New(func(a, b interface{}) bool {
return a.(string) < b.(string)
})
c := bt.PathContext()
c.Set("abc")
fmt.Println(c.Get("abc"))
c.Delete("abc")
} |
@tommie Your PathContext idea is slick. I'm not sure that it's best suited for adding directly to this library but I can see how it others might find it convenient. |
I am trying to understand how exactly I can use path hint methods. Could you please give some examples in the Readme. That would be helpful.
The text was updated successfully, but these errors were encountered: