Documentation
¶
Overview ¶
Package polign implements Recall's context-aware Backend over the Polign HTTP API. It uses typed metadata and exact, internally paginated vector listings.
Index ¶
- type Backend
- func (b *Backend) AcquireLease(ctx context.Context, collection, name, holder string, ttl time.Duration) (recall.LeaseGrant, error)
- func (b *Backend) List(ctx context.Context, collection string, filter map[string]any, limit int) ([]recall.StoredVector, int, error)
- func (b *Backend) Put(ctx context.Context, collection, id string, values []float32, ...) error
- func (b *Backend) ReleaseLease(ctx context.Context, collection, name, holder string, epoch uint64) error
- func (b *Backend) RenewLease(ctx context.Context, collection, name, holder string, epoch uint64, ...) (recall.LeaseGrant, error)
- func (b *Backend) Search(ctx context.Context, collection string, values []float32, k int, ...) ([]recall.Hit, error)
- func (b *Backend) Watermark(ctx context.Context, collection string) (string, error)
- type Config
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a reusable Polign client, safe for concurrent calls.
func (*Backend) AcquireLease ¶ added in v0.6.0
func (b *Backend) AcquireLease(ctx context.Context, collection, name, holder string, ttl time.Duration) (recall.LeaseGrant, error)
AcquireLease takes an agent's lease. A live holder is reported as a recall.LeaseHeldError; a server without the lease API as recall.ErrLeaseUnsupported.
func (*Backend) List ¶
func (b *Backend) List(ctx context.Context, collection string, filter map[string]any, limit int) ([]recall.StoredVector, int, error)
List returns up to limit exact matches and the exact total, paging internally. Limits up to MaxHistoryEvents+1 support every bounded Recall read, including its overflow probe. Changing totals, duplicate/reordered IDs, or incomplete pages return errors without exposing a partial history.
func (*Backend) Put ¶
func (b *Backend) Put(ctx context.Context, collection, id string, values []float32, metadata map[string]any) error
Put upserts one immutable event ID. It does not automatically retry writes.
func (*Backend) ReleaseLease ¶ added in v0.6.0
func (b *Backend) ReleaseLease(ctx context.Context, collection, name, holder string, epoch uint64) error
ReleaseLease hands a held lease over at once.
func (*Backend) RenewLease ¶ added in v0.6.0
func (b *Backend) RenewLease(ctx context.Context, collection, name, holder string, epoch uint64, ttl time.Duration) (recall.LeaseGrant, error)
RenewLease extends a held lease; a 409 means another holder took over and is reported as recall.ErrLeaseLost.
func (*Backend) Search ¶
func (b *Backend) Search(ctx context.Context, collection string, values []float32, k int, filter map[string]any) ([]recall.Hit, error)
Search retrieves semantic candidates using the supplied query vector.
func (*Backend) Watermark ¶
Watermark returns the serving node's opaque visible-log revision. Servers without the endpoint fall back to uncached Recall reads.
501 belongs with 404 and 405: it is the conventional answer from a proxy or an older gateway in front of a server that predates the endpoint. A 200 whose body carries no watermark is the same case, and reporting it as unsupported keeps a server that answers the route without implementing it from failing every read.
type Config ¶
type Config struct {
BaseURL string
APIKey string
HTTPClient *http.Client
// MaxResponseBytes bounds each response; zero defaults to 64 MiB. Large
// vector dimensions may require a larger bound even for metadata-only uses.
MaxResponseBytes int64
}
Config selects a Polign endpoint and credential. The default HTTP client has a 30-second timeout and does not follow redirects. A supplied HTTPClient keeps its own timeout/redirect policy and must be safe for concurrent use.
type StatusError ¶
StatusError reports an HTTP error without losing its machine-readable status.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
func (*StatusError) NotFound ¶ added in v0.6.0
func (e *StatusError) NotFound() bool
NotFound reports a 404, which Recall reads as "nothing written here yet" when an agent lists a collection it has not written to.