Documentation
¶
Overview ¶
Package meta provides interfaces and implementations to work with metadata protocol of DeGitX, metadata structure is an abstract key-value storage.
Index ¶
Constants ¶
View Source
const StandardTimeout = 30 * time.Second
StandardTimeout of blocking operations
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Data ¶
type Data string
Data - alias for immutable bytes representation with helper methods
type ErrNotFound ¶
type ErrNotFound struct {
Key string
}
ErrNotFound returned if a value for key was not found
func (*ErrNotFound) Error ¶
func (e *ErrNotFound) Error() string
type Response ¶
type Response struct {
// Key of metadata response
Key string
// Value of metadata
Value Data
// Error on failure
Error error
}
Response - type of metadata storage response
type Storage ¶
type Storage interface {
// Get returns a channel with single response item,
// channel is closed on context cancellation. Context
// shold be cancelled with defer.
Get(ctx context.Context, key string) <-chan *Response
// Set updates metadata storage, channel with a
// value is returned on success, a value could differ from
// provided value, if storage received new value after this request
// but before response. Channel is closed on context
// cancellation. Context should be cancelled with defer.
Set(ctx context.Context, key string, val Data) <-chan *Response
}
Storage - interface of metadata storage with async operations
func NewInMemStorage ¶
func NewInMemStorage() Storage
NewInMemStorage creates metadata storage in memory, useful for testing
Click to show internal directories.
Click to hide internal directories.