Documentation ¶
Index ¶
- Variables
- func Connect(u *url.URL) (net.Conn, error)
- func PutArrayReader(reader *ArrayReader)
- type ArrayReader
- type Client
- type Error
- type Factory
- type Filter
- func (f Filter) BulkSet(reader KeyReader) (ResultReader, error)
- func (f Filter) Check(key Key) (bool, error)
- func (f Filter) Clear() error
- func (f Filter) Close() error
- func (f Filter) Drop() error
- func (f Filter) Flush() error
- func (f Filter) Info() (map[string]string, error)
- func (f Filter) MultiCheck(reader KeyReader) (ResultReader, error)
- func (f Filter) Set(key Key) (bool, error)
- type Key
- type KeyReader
- type Pool
- type ResultReader
Constants ¶
This section is empty.
Variables ¶
var DefaultBufferSize = 4096
DefaultBufferSize is the default size for the read buffer
var ErrCursorOverLength = errors.New("resultReader: cursor is over length")
Functions ¶
func Connect ¶
Connect initialises a new connection to bloomd server it uses url.Scheme to determine which type of connection should be established: unix - for Unix Domain Socket tcp - for TCP
func PutArrayReader ¶
func PutArrayReader(reader *ArrayReader)
Types ¶
type ArrayReader ¶
type ArrayReader struct {
// contains filtered or unexported fields
}
func GetArrayReader ¶
func GetArrayReader(arr []Key) *ArrayReader
func NewArrayReader ¶
func NewArrayReader(arr ...Key) *ArrayReader
func (ArrayReader) Current ¶
func (sr ArrayReader) Current() Key
func (*ArrayReader) Next ¶
func (sr *ArrayReader) Next() bool
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a bloomd client
func NewFromAddr ¶
NewFromAddr creates a new bloomd client from addr
func NewFromConn ¶
NewFromConn creates a new bloomd client from net.Conn
func NewFromURL ¶
NewFromURL creates a new bloomd client from URL struct
func (*Client) Close ¶
Close closes underlying connection or return the connection to the Pool if one was used
func (*Client) CreateFilter ¶
func (cli *Client) CreateFilter(name string, capacity int, prob float64, inMemory bool) (Filter, error)
CreateFilter creates a new filter or returns an existing one
func (*Client) ListFilters ¶
ListFilters list all filters
type Filter ¶
type Filter struct { Name string // contains filtered or unexported fields }
Filter represents a single filter in the bloomd server
func (Filter) BulkSet ¶
func (f Filter) BulkSet(reader KeyReader) (ResultReader, error)
BulkSet adds multiple keys to the filter
func (Filter) MultiCheck ¶
func (f Filter) MultiCheck(reader KeyReader) (ResultReader, error)
MultiCheck checks multiple keys for the filter
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool of bloomd clients
func NewPoolFromAddr ¶
NewPoolFromAddr return a new pool of client for addr
func NewPoolFromFactory ¶
NewPoolFromFactory returns a new pool of clients for a connection factory
func NewPoolFromURL ¶
NewPoolFromURL return a new pool of client for locator
type ResultReader ¶
type ResultReader interface { Next() (bool, error) Read(p []bool) (n int, err error) Length() int // Usually any Reader implementation should not contain Length() method but from bloomd protocol we always know the result length - so it could be usefull information Close() error }
ResultReader allows to read filter results