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.

36 lines
651 B

  1. package metastore
  2. import (
  3. "fmt"
  4. )
  5. //this is for testing only
  6. type MetaStoreMemoryBacking struct {
  7. m map[string]string
  8. }
  9. func NewMetaStoreMemoryBacking() *MetaStoreMemoryBacking {
  10. mms := &MetaStoreMemoryBacking{}
  11. mms.m = make(map[string]string)
  12. return mms
  13. }
  14. func (mms MetaStoreMemoryBacking) Set(path, val string) error {
  15. mms.m[path] = val
  16. return nil
  17. }
  18. func (mms MetaStoreMemoryBacking) Get(path string) (val string, err error) {
  19. var ok bool
  20. val, ok = mms.m[path]
  21. if !ok {
  22. return "", fmt.Errorf("Missing value for %s", path)
  23. }
  24. return
  25. }
  26. func (mms MetaStoreMemoryBacking) Has(path string) (ok bool) {
  27. _, ok = mms.m[path]
  28. return
  29. }