1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-30 08:06:40 +02:00
go-micro/data/store/store.go
2019-06-19 22:04:13 +01:00

35 lines
622 B
Go

// Package store is an interface for distribute data storage.
package store
import (
"errors"
"time"
"github.com/micro/go-micro/config/options"
)
var (
ErrNotFound = errors.New("not found")
)
// Store is a data storage interface
type Store interface {
// embed options
options.Options
// Dump the known records
Dump() ([]*Record, error)
// Read a record with key
Read(key string) (*Record, error)
// Write a record
Write(r *Record) error
// Delete a record with key
Delete(key string) error
}
// Record represents a data record
type Record struct {
Key string
Value []byte
Expiry time.Duration
}