2015-01-13 23:31:27 +00:00
|
|
|
package store
|
|
|
|
|
|
|
|
type Store interface {
|
|
|
|
Get(string) (Item, error)
|
|
|
|
Del(string) error
|
|
|
|
Put(Item) error
|
|
|
|
NewItem(string, []byte) Item
|
|
|
|
}
|
|
|
|
|
2015-05-16 00:34:02 +01:00
|
|
|
type options struct{}
|
|
|
|
|
|
|
|
type Options func(*options)
|
|
|
|
|
2015-01-13 23:31:27 +00:00
|
|
|
var (
|
2015-05-16 00:34:02 +01:00
|
|
|
DefaultStore = NewConsulStore([]string{})
|
2015-01-13 23:31:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func Get(key string) (Item, error) {
|
|
|
|
return DefaultStore.Get(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Del(key string) error {
|
|
|
|
return DefaultStore.Del(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Put(item Item) error {
|
|
|
|
return DefaultStore.Put(item)
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewItem(key string, value []byte) Item {
|
|
|
|
return DefaultStore.NewItem(key, value)
|
|
|
|
}
|