You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
437 B

10 years ago
11 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. package merkle
  2. import (
  3. "fmt"
  4. )
  5. type Db interface {
  6. Get([]byte) []byte
  7. Set([]byte, []byte)
  8. }
  9. type Tree interface {
  10. Size() uint64
  11. Height() uint8
  12. Has(key []byte) bool
  13. Get(key []byte) []byte
  14. HashWithCount() ([]byte, uint64)
  15. Hash() []byte
  16. Save()
  17. SaveKey(string)
  18. Set(key []byte, vlaue []byte) bool
  19. Remove(key []byte) ([]byte, error)
  20. Copy() Tree
  21. }
  22. func NotFound(key []byte) error {
  23. return fmt.Errorf("Key was not found.")
  24. }