quickstore

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 13 Imported by: 0

README

Quickstore – fast and thread-safe key-value store with low contention and builtin cache

Go Report Card

Quickstore acts as a cache layer on top of DynamoDB. All mutations are performed in Quickstore before being written out to DynamoDB, thus allowing extremely fast read/write and low network latency.

Features:

  • In-memory database performance.
  • Low thread contention since data entries are partitioned into multiple nodes, allowing efficient parallelism.
  • Reduce number of call to DynamoDB using builtin-cache, cut down costs and reduce network latency to minimal.
  • Mutations are applied to cache and later applied to DynamoDB in a different thread.
  • Gracefully handling crash by logging unwritten mutations.
  • Custom error types for fine-grained error handling.

Restriction:

  • Primary key contains only partition key to avoid hot partition.

Documentation

Index

Constants

View Source
const (
	ErrCodeSerializeException = "SerializeException"
	ErrCodeItemExisted        = "ItemExisted"
	ErrCodeItemNotExisted     = "ItemNotExisted"
	ErrCodeTooManyRequests    = "TooManyRequests"
	ErrCodeClosed             = "Closed"
	ErrCodeDynamoDBException  = "DynamoDBException"
)

Variables

View Source
var Registry = registry{
	// contains filtered or unexported fields
}

Functions

func RandIdentifier

func RandIdentifier() string

Types

type ErrClosed

type ErrClosed struct {
	// contains filtered or unexported fields
}

func (ErrClosed) Cause

func (b ErrClosed) Cause() error

func (ErrClosed) Code

func (b ErrClosed) Code() string

func (ErrClosed) Error

func (b ErrClosed) Error() string

func (ErrClosed) Message

func (b ErrClosed) Message() string

func (ErrClosed) String

func (b ErrClosed) String() string

type ErrDynamoDBException

type ErrDynamoDBException struct {
	// contains filtered or unexported fields
}

func (ErrDynamoDBException) Cause

func (b ErrDynamoDBException) Cause() error

func (ErrDynamoDBException) Code

func (b ErrDynamoDBException) Code() string

func (ErrDynamoDBException) Error

func (b ErrDynamoDBException) Error() string

func (ErrDynamoDBException) Message

func (b ErrDynamoDBException) Message() string

func (ErrDynamoDBException) String

func (b ErrDynamoDBException) String() string

type ErrItemExisted

type ErrItemExisted struct {
	// contains filtered or unexported fields
}

func (ErrItemExisted) Cause

func (b ErrItemExisted) Cause() error

func (ErrItemExisted) Code

func (b ErrItemExisted) Code() string

func (ErrItemExisted) Error

func (b ErrItemExisted) Error() string

func (*ErrItemExisted) Key

func (e *ErrItemExisted) Key() Key

func (ErrItemExisted) Message

func (b ErrItemExisted) Message() string

func (ErrItemExisted) String

func (b ErrItemExisted) String() string

type ErrItemNotExisted

type ErrItemNotExisted struct {
	// contains filtered or unexported fields
}

func (ErrItemNotExisted) Cause

func (b ErrItemNotExisted) Cause() error

func (ErrItemNotExisted) Code

func (b ErrItemNotExisted) Code() string

func (ErrItemNotExisted) Error

func (b ErrItemNotExisted) Error() string

func (ErrItemNotExisted) Message

func (b ErrItemNotExisted) Message() string

func (ErrItemNotExisted) String

func (b ErrItemNotExisted) String() string

type ErrSerializeException

type ErrSerializeException struct {
	// contains filtered or unexported fields
}

func (ErrSerializeException) Cause

func (b ErrSerializeException) Cause() error

func (ErrSerializeException) Code

func (b ErrSerializeException) Code() string

func (ErrSerializeException) Error

func (b ErrSerializeException) Error() string

func (ErrSerializeException) Message

func (b ErrSerializeException) Message() string

func (ErrSerializeException) String

func (b ErrSerializeException) String() string

type ErrTooManyRequests

type ErrTooManyRequests struct {
	// contains filtered or unexported fields
}

func (ErrTooManyRequests) Cause

func (b ErrTooManyRequests) Cause() error

func (ErrTooManyRequests) Code

func (b ErrTooManyRequests) Code() string

func (ErrTooManyRequests) Error

func (b ErrTooManyRequests) Error() string

func (ErrTooManyRequests) Message

func (b ErrTooManyRequests) Message() string

func (ErrTooManyRequests) String

func (b ErrTooManyRequests) String() string

type Error

type Error interface {
	error
	Code() string
	Message() string
	Cause() error
}

type Key

type Key struct {
	Parent     string
	Kind       string
	Identifier string
}

func Parse

func Parse(s string) Key

func (*Key) Incomplete

func (k *Key) Incomplete() bool

func (*Key) MarshalDynamoDBAttributeValue

func (k *Key) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

func (*Key) String

func (k *Key) String() string

func (*Key) UnmarshalDynamoDBAttributeValue

func (k *Key) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(client *dynamodb.DynamoDB, table string) (*Store, error)

func (*Store) CloseAndWait

func (s *Store) CloseAndWait()

func (*Store) Delete

func (s *Store) Delete(key Key) error

func (*Store) DoesItemExist

func (s *Store) DoesItemExist(ctx context.Context, key Key) (bool, error)

func (*Store) Get

func (s *Store) Get(ctx context.Context, key Key) (*dynamodb.AttributeValue, error)

func (*Store) GetMulti

func (s *Store) GetMulti(ctx context.Context, keys map[Key]bool) (map[Key]*dynamodb.AttributeValue, error)

func (*Store) Insert

func (s *Store) Insert(key Key, value interface{}) error

func (*Store) Update

func (s *Store) Update(key Key, value interface{}) error

func (*Store) Upsert

func (s *Store) Upsert(key Key, value interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL