Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) Get(ctx context.Context, hash needle.Hash) (*needle.Needle, error)
- func (c *Client) GetBytes(ctx context.Context, hashBytes []byte) ([]byte, error)
- func (c *Client) Set(ctx context.Context, n *needle.Needle) error
- func (c *Client) SetBytes(ctx context.Context, data []byte) error
- func (c *Client) Stats() PoolStats
- type Config
- type PoolStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a high-performance, connection-pooled interface to Haystack servers. It handles connection management, timeouts, and error recovery automatically.
func (*Client) Set ¶
Set stores a needle on the Haystack server. This is a fire-and-forget operation - no response is expected.
type Config ¶
type Config struct {
// Address of the Haystack server (e.g., "localhost:1337")
Address string
// Maximum number of connections in the pool (default: 10)
MaxConnections int
// Read timeout for GET operations (default: 5s)
ReadTimeout time.Duration
// Write timeout for SET operations (default: 5s)
WriteTimeout time.Duration
// How long to keep idle connections (default: 30s)
IdleTimeout time.Duration
// Logger for error and debug messages (optional, uses NoOp if nil)
Logger logger.Logger
}
Config holds configuration options for the Haystack client.
func DefaultConfig ¶
DefaultConfig returns a configuration with sensible defaults.
Click to show internal directories.
Click to hide internal directories.