micro/store/store.go

37 lines
548 B
Go
Raw Normal View History

2015-01-14 02:31:27 +03:00
package store
type Store interface {
Get(string) (*Item, error)
2015-01-14 02:31:27 +03:00
Del(string) error
Put(*Item) error
}
type Item struct {
Key string
Value []byte
2015-01-14 02:31:27 +03:00
}
type options struct{}
type Option func(*options)
2015-01-14 02:31:27 +03:00
var (
DefaultStore = newConsulStore([]string{})
2015-01-14 02:31:27 +03:00
)
func NewStore(addrs []string, opt ...Option) Store {
return newConsulStore(addrs, opt...)
}
func Get(key string) (*Item, error) {
2015-01-14 02:31:27 +03:00
return DefaultStore.Get(key)
}
func Del(key string) error {
return DefaultStore.Del(key)
}
func Put(item *Item) error {
2015-01-14 02:31:27 +03:00
return DefaultStore.Put(item)
}