Documentation ¶
Index ¶
- Constants
- Variables
- func CreateLog(opts map[string]interface{})
- func FlushLog()
- func NewEncoder(dataShards int, parityShards int, ecMaxGoroutine int) reedsolomon.Encoder
- func SetLogger(l func(nanolog.Handle, ...interface{}) error)
- type ByteJoiner
- type Client
- func (c *Client) Close()
- func (c *Client) Dial(addrArr []string) bool
- func (c *Client) EcGet(key string, args ...interface{}) (string, ReadAllCloser, error)
- func (c *Client) EcSet(key string, val []byte, args ...interface{}) (string, error)
- func (c *Client) Get(key string) (ReadAllCloser, bool)
- func (c *Client) ReadResponse(req client.Request) error
- func (c *Client) Set(key string, val []byte) bool
- type ClientConnMeta
- type ClientRequest
- type DummyEncoder
- func (enc *DummyEncoder) Encode(shards [][]byte) error
- func (enc *DummyEncoder) Join(dst io.Writer, shards [][]byte, outSize int) error
- func (enc *DummyEncoder) Reconstruct(shards [][]byte) (err error)
- func (enc *DummyEncoder) ReconstructData(shards [][]byte) (err error)
- func (enc *DummyEncoder) Split(data []byte) ([][]byte, error)
- func (enc *DummyEncoder) Update(shards [][]byte, newDatashards [][]byte) error
- func (enc *DummyEncoder) Verify(shards [][]byte) (bool, error)
- type JoinReader
- type PooledClient
- type ReadAllCloser
- type WaitGroup
Constants ¶
const ( LargeObjectThreshold = 30000000 // 20 MB per chunk LargeObjectSplitUnit = 10000000 // 10 MB per chunk )
Variables ¶
var ( Hasher = &hasher{partitionCount: 271} ECConfig = consistent.Config{ PartitionCount: 271, ReplicationFactor: 20, Load: 1.25, Hasher: Hasher, } ErrNotFound = errors.New("not found") ErrClient = errors.New("client internal error") ErrDialShortcut = errors.New("failed to dial shortcut, check the RedisAdapter") ErrNoRequest = errors.New("request not present") ErrClientClosed = errors.New("client closed") CtxKeyECRet = reqCtxKey("ecret") )
var ( // ErrUnexpectedResponse Unexplected response ErrUnexpectedResponse = errors.New("unexpected response") ErrUnexpectedPreflightPong = errors.New("unexpected preflight pong") ErrMaxPreflightsReached = errors.New("max preflight attempts reached") ErrAbandonRequest = errors.New("abandon request") ErrKeyNotFound = errors.New("key not found") ErrEmptyChunk = errors.New("empty chunk") ErrUnknown = errors.New("unknown error") RequestAttempts = 3 OccupantReadAllCloser = &JoinReader{} )
var ( // MaxLambdaStores This setting will avoid network contention. Must equal or smaller than config.NumLambdaClusters MaxLambdaStores int = config.SliceSize // Timeout The timeout of a single operation Timeout = 1 * time.Second // Timeout The timeout for sending header fields, and reading response headers. HeaderTimeout = 1 * time.Second )
var ( ErrInvalidSize = errors.New("invalid size") ErrInvalidNumFragments = errors.New("invalid number of fragments") ErrAbandon = errors.New("late chunk abandoned") ErrCorrupted = errors.New("data corrupted") )
var ( // ErrNotImplemented The error indicates specified function is not implemented. ErrNotImplemented = errors.New("not implemented") )
Functions ¶
func CreateLog ¶
func CreateLog(opts map[string]interface{})
CreateLog Enabling evaluation log in client lib.
func NewEncoder ¶
func NewEncoder(dataShards int, parityShards int, ecMaxGoroutine int) reedsolomon.Encoder
NewEncoder Helper function to create a encoder
Types ¶
type ByteJoiner ¶
Joiner The utility function helps to concat an array of []bytes.
type Client ¶
type Client struct { EC reedsolomon.Encoder Ring *consistent.Consistent DataShards int ParityShards int Shards int // contains filtered or unexported fields }
Client defines a InfiniStore client
func (*Client) EcGet ¶
func (c *Client) EcGet(key string, args ...interface{}) (string, ReadAllCloser, error)
EcGet Internal API returns reqId, reader, and a bool indicate error. If not found, the reader will be nil.
type ClientConnMeta ¶
type ClientRequest ¶
type ClientRequest struct { client.Request Cmd string ReqId string Cancel context.CancelFunc // contains filtered or unexported fields }
func (*ClientRequest) Conn ¶
func (r *ClientRequest) Conn() *client.Conn
func (*ClientRequest) SetConn ¶
func (r *ClientRequest) SetConn(cn *client.Conn)
type DummyEncoder ¶
type DummyEncoder struct {
DataShards int
}
DummyEncoder Dummpy encoder to support 0 parity.
func (*DummyEncoder) Encode ¶
func (enc *DummyEncoder) Encode(shards [][]byte) error
Encode reedsolomon.Encoder implmentation
func (*DummyEncoder) Reconstruct ¶
func (enc *DummyEncoder) Reconstruct(shards [][]byte) (err error)
Reconstruct reedsolomon.Encoder implmentation
func (*DummyEncoder) ReconstructData ¶
func (enc *DummyEncoder) ReconstructData(shards [][]byte) (err error)
ReconstructData reedsolomon.Encoder implmentation
func (*DummyEncoder) Split ¶
func (enc *DummyEncoder) Split(data []byte) ([][]byte, error)
Split reedsolomon.Encoder implmentation
type JoinReader ¶
JoinReader A ReadAllCloser implementation that can concat an array of []bytes
func NewByteJoinReader ¶
func NewByteJoinReader(data [][]byte, size int, joiner ByteJoiner) *JoinReader
NewByteJoinReader Create the join reader for []byte array
func NewJoinReader ¶
func NewJoinReader(data interface{}, size int) *JoinReader
func (*JoinReader) Close ¶
func (r *JoinReader) Close() error
Close ReaderAllCloser implementation Drain reader if any read.
func (*JoinReader) Read ¶
func (r *JoinReader) Read(p []byte) (n int, err error)
Read io.Reader implementation
func (*JoinReader) ReadAll ¶
func (r *JoinReader) ReadAll() (buf []byte, err error)
ReadAll ReaderAllCloser implementation
type PooledClient ¶
type PooledClient struct { // Concurrency supported Concurrency int // Default # of data shards NumDataShards int // Default # of parity shards NumParityShards int // Max goroutine used by Erasure Coding ECMaxGoroutine int // contains filtered or unexported fields }
func NewPooledClient ¶
func NewPooledClient(addrArr []string, options ...func(*PooledClient)) *PooledClient
func (*PooledClient) Close ¶
func (c *PooledClient) Close()
func (*PooledClient) Get ¶
func (c *PooledClient) Get(key string) (ReadAllCloser, error)
type ReadAllCloser ¶
ReadAllCloser Allows to get length and read all from the reader.