Documentation
¶
Index ¶
- type Client
- type ClientConfig
- type Condition
- type Filter
- type GRPCClient
- func (c *GRPCClient) Close() error
- func (c *GRPCClient) CollectionExists(ctx context.Context, name string) (bool, error)
- func (c *GRPCClient) CreateCollection(ctx context.Context, name string, vectorSize uint64) error
- func (c *GRPCClient) Delete(ctx context.Context, collection string, ids []string) error
- func (c *GRPCClient) DeleteCollection(ctx context.Context, name string) error
- func (c *GRPCClient) Get(ctx context.Context, collection string, ids []string) ([]*Point, error)
- func (c *GRPCClient) Health(ctx context.Context) error
- func (c *GRPCClient) ListCollections(ctx context.Context) ([]string, error)
- func (c *GRPCClient) Search(ctx context.Context, collection string, vector []float32, limit uint64, ...) ([]*ScoredPoint, error)
- func (c *GRPCClient) Upsert(ctx context.Context, collection string, points []*Point) error
- type Point
- type RangeCondition
- type ScoredPoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Collection operations
CreateCollection(ctx context.Context, name string, vectorSize uint64) error
DeleteCollection(ctx context.Context, name string) error
CollectionExists(ctx context.Context, name string) (bool, error)
ListCollections(ctx context.Context) ([]string, error)
// Point operations
Upsert(ctx context.Context, collection string, points []*Point) error
Search(ctx context.Context, collection string, vector []float32, limit uint64, filter *Filter) ([]*ScoredPoint, error)
Get(ctx context.Context, collection string, ids []string) ([]*Point, error)
Delete(ctx context.Context, collection string, ids []string) error
// Health
Health(ctx context.Context) error
// Close closes the client connection
Close() error
}
Client provides a unified interface to Qdrant vector database. This is a stub interface for contextd-v2 port - full implementation pending.
type ClientConfig ¶
type ClientConfig struct {
// Host is the Qdrant server hostname or IP address.
// Default: "localhost"
Host string
// Port is the Qdrant gRPC port (NOT HTTP REST port).
// Default: 6334 (gRPC), not 6333 (HTTP)
Port int
// UseTLS enables TLS encryption for gRPC connection.
// Default: false (for local development)
UseTLS bool
// APIKey is the optional API key for authentication.
// Leave empty for local development.
APIKey string
// MaxMessageSize is the maximum gRPC message size in bytes.
// Default: 50MB (to handle large documents)
MaxMessageSize int
// DialTimeout is the timeout for establishing connection.
// Default: 5 seconds
DialTimeout time.Duration
// RequestTimeout is the default timeout for individual requests.
// Default: 30 seconds
RequestTimeout time.Duration
// RetryAttempts is the number of retry attempts for transient failures.
// Default: 3
RetryAttempts int
// Distance is the default distance metric for new collections.
// Default: Cosine
Distance qdrant.Distance
}
ClientConfig configures the Qdrant gRPC client.
func DefaultClientConfig ¶
func DefaultClientConfig() *ClientConfig
DefaultClientConfig returns sensible defaults for local development.
func (*ClientConfig) ApplyDefaults ¶
func (c *ClientConfig) ApplyDefaults()
ApplyDefaults sets default values for unset fields.
func (*ClientConfig) Validate ¶
func (c *ClientConfig) Validate() error
Validate validates the client configuration.
type Condition ¶
type Condition struct {
Field string
Match interface{}
Range *RangeCondition
}
Condition represents a filter condition.
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient implements the Client interface using Qdrant's official Go client.
func NewGRPCClient ¶
func NewGRPCClient(config *ClientConfig, logger *logging.Logger) (*GRPCClient, error)
NewGRPCClient creates a new Qdrant gRPC client.
func (*GRPCClient) CollectionExists ¶
CollectionExists checks if a collection exists.
func (*GRPCClient) CreateCollection ¶
CreateCollection creates a new collection with the specified configuration.
func (*GRPCClient) DeleteCollection ¶
func (c *GRPCClient) DeleteCollection(ctx context.Context, name string) error
DeleteCollection deletes a collection and all its documents.
func (*GRPCClient) Health ¶
func (c *GRPCClient) Health(ctx context.Context) error
Health performs a health check on the Qdrant connection.
func (*GRPCClient) ListCollections ¶
func (c *GRPCClient) ListCollections(ctx context.Context) ([]string, error)
ListCollections returns a list of all collection names.
type RangeCondition ¶
RangeCondition represents a range filter.
type ScoredPoint ¶
ScoredPoint represents a search result with score.