qdrantgrpc

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 27 Imported by: 0

README

Qdrant gRPC Compatibility Layer

This package provides a Qdrant-compatible gRPC API for NornicDB, enabling existing Qdrant SDKs to connect without modification.

Overview

NornicDB implements the Qdrant gRPC API (pinned to v1.16.x) to enable:

  • Multi-language SDK reuse: Python, Go, Rust, JavaScript, and other Qdrant clients work out of the box
  • Zero-migration vector search: Existing applications can switch to NornicDB without code changes
  • High-performance protocol: Direct protobuf (no JSON) for minimal latency
  • Unified indexing: Points added via Qdrant gRPC are searchable via /nornicdb/search and vice versa

Feature Flag

The Qdrant gRPC endpoint is disabled by default and must be explicitly enabled:

Environment Variable
export NORNICDB_QDRANT_GRPC_ENABLED=true
export NORNICDB_QDRANT_GRPC_LISTEN_ADDR=":6334"  # optional, default is :6334
Embedding Ownership (Important)

NornicDB can run in two modes:

  • NornicDB-managed embeddings (NORNICDB_EMBEDDING_ENABLED=true): Qdrant vector mutation RPCs (Upsert, UpdateVectors, DeleteVectors) return FailedPrecondition to avoid conflicting sources of truth.
  • Client-managed vectors via Qdrant gRPC (NORNICDB_EMBEDDING_ENABLED=false): Qdrant clients can fully manage stored vectors/embeddings via gRPC (recommended when you are using Qdrant SDKs as-is).
Configuration
features:
  qdrant_grpc_enabled: true
  qdrant_grpc_listen_addr: ":6334"
  qdrant_grpc_max_vector_dim: 4096
  qdrant_grpc_max_batch_points: 1000
  qdrant_grpc_max_top_k: 1000

Supported Features

NornicDB exposes a single gRPC surface: the official upstream Qdrant gRPC contract (package qdrant), so real Qdrant SDKs (Python qdrant-client, etc.) work without modification.

Implemented for SDK compatibility (and covered by scripts/qdrantgrpc_e2e_python.sh):

Collections Service
RPC Status Notes
Create Single-vector and named-vector configs
Get Returns minimal-but-valid CollectionInfo with defaults filled for SDK parsing
List
Delete Deletes collection metadata and points
Update Acknowledges existence (NornicDB manages params)
CollectionExists
Points Service (core)
RPC Status Notes
Upsert Dense vectors + named vectors
Get With payload/vectors selectors
Delete By ID list or filter
Count
Search Score threshold + vector_name supported
Query / QueryBatch Supports VectorInput (Dense/Id) and Document when embeddings are enabled
Scroll
SetPayload / OverwritePayload / DeletePayload / ClearPayload
UpdateVectors / DeleteVectors Subject to embedding ownership flag

Other upstream Qdrant RPCs are currently UNIMPLEMENTED and can be added as needed.

Text Queries via Upstream Qdrant API (Points.Query)

NornicDB supports Qdrant’s upstream “inference-shaped” query inputs by implementing:

  • qdrant.Points/Query
  • qdrant.Points/QueryBatch

This allows clients to send a document/text query (rather than a numeric vector) using the upstream protobuf contract:

  • VectorInput.Document (Document.text)
Requirements
  • NORNICDB_QDRANT_GRPC_ENABLED=true
  • NORNICDB_EMBEDDING_ENABLED=true (so NornicDB can embed the query text). If embeddings are disabled, VectorInput.Document returns FailedPrecondition.
Go Example (direct gRPC call)
conn, _ := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()

points := qdrant.NewPointsClient(conn)

resp, err := points.Query(ctx, &qdrant.QueryPoints{
    CollectionName: "my_collection",
    Limit:          10,
    Query: &qdrant.Query{
        Variant: &qdrant.Query_Nearest{
            Nearest: &qdrant.VectorInput{
                Variant: &qdrant.VectorInput_Document{
                    Document: &qdrant.Document{Text: "database performance"},
                },
            },
        },
    },
    WithPayload: &qdrant.WithPayloadSelector{
        SelectorOptions: &qdrant.WithPayloadSelector_Enable{Enable: true},
    },
})
if err != nil {
    // handle error
}
_ = resp

Quick Start

Production Server Setup

For production use, provide the search.Service to enable unified vector indexing:

package main

import (
    "log"
    
    "github.com/orneryd/nornicdb/pkg/qdrantgrpc"
    "github.com/orneryd/nornicdb/pkg/search"
    "github.com/orneryd/nornicdb/pkg/storage"
)

func main() {
    // Create persistent base storage (Badger for production)
    base, err := storage.NewBadgerEngine("./data")
    if err != nil {
        log.Fatal(err)
    }
    defer base.Close()

    // Create database manager (collections map to database namespaces)
    dbManager, err := multidb.NewDatabaseManager(base, nil)
    if err != nil {
        log.Fatal(err)
    }
    
    // Configure server
    config := qdrantgrpc.DefaultConfig()
    config.ListenAddr = ":6334"
    
    // Create server (collections = databases; no migration/back-compat)
    server, err := qdrantgrpc.NewServerWithDatabaseManager(config, dbManager, base, nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    
    if err := server.Start(); err != nil {
        log.Fatal(err)
    }
    defer server.Stop()
    
    log.Printf("Qdrant gRPC server listening on %s", server.Addr())
    
    // Keep running...
    select {}
}
Python Client Example
from qdrant_client import QdrantClient
from qdrant_client.models import VectorParams, Distance, PointStruct

# Connect to NornicDB's Qdrant-compatible endpoint
client = QdrantClient(host="localhost", port=6334, grpc=True)

# Create a collection
client.create_collection(
    collection_name="my_vectors",
    vectors_config=VectorParams(size=1024, distance=Distance.COSINE)
)

# Insert vectors
client.upsert(
    collection_name="my_vectors",
    points=[
        PointStruct(
            id="doc-1",
            vector=[0.1] * 1024,
            payload={"title": "Document 1", "category": "tech"}
        ),
        PointStruct(
            id="doc-2",
            vector=[0.2] * 1024,
            payload={"title": "Document 2", "category": "science"}
        ),
    ]
)

# Search
results = client.search(
    collection_name="my_vectors",
    query_vector=[0.15] * 1024,
    limit=10,
    with_payload=True
)

# Scroll through all points
scroll_results = client.scroll(
    collection_name="my_vectors",
    limit=100,
    with_payload=True
)

# Update payload
client.set_payload(
    collection_name="my_vectors",
    points=["doc-1"],
    payload={"updated": True}
)

# Recommend similar points
recommendations = client.recommend(
    collection_name="my_vectors",
    positive=["doc-1"],
    negative=["doc-2"],
    limit=5
)
Go Client Example
package main

import (
    "context"
    "log"
    
    qdrant "github.com/qdrant/go-client/qdrant"
)

func main() {
    client, err := qdrant.NewClient(&qdrant.Config{
        Host: "localhost",
        Port: 6334,
    })
    if err != nil {
        log.Fatal(err)
    }
    
    ctx := context.Background()
    
    // Create collection
    err = client.CreateCollection(ctx, &qdrant.CreateCollection{
        CollectionName: "my_vectors",
        VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
            Size:     1024,
            Distance: qdrant.Distance_Cosine,
        }),
    })
    
    // Upsert points
    _, err = client.Upsert(ctx, &qdrant.UpsertPoints{
        CollectionName: "my_vectors",
        Points: []*qdrant.PointStruct{
            {
                Id:      qdrant.NewIDNum(1),
                Vectors: qdrant.NewVectors(0.1, 0.2, 0.3 /* ... */),
                Payload: qdrant.NewValueMap(map[string]any{
                    "title": "Document 1",
                }),
            },
        },
    })
    
    // Search
    results, err := client.Search(ctx, &qdrant.SearchPoints{
        CollectionName: "my_vectors",
        Vector:         []float32{0.1, 0.2, 0.3 /* ... */},
        Limit:          10,
        WithPayload:    qdrant.NewWithPayload(true),
    })
    
    // Update vectors
    _, err = client.UpdateVectors(ctx, &qdrant.UpdatePointVectors{
        CollectionName: "my_vectors",
        Points: []*qdrant.PointVectors{
            {
                Id:      qdrant.NewIDNum(1),
                Vectors: qdrant.NewVectors(0.5, 0.5, 0.5 /* ... */),
            },
        },
    })
}

Configuration

Option Default Description Env Variable
QdrantGRPCEnabled false Enable the Qdrant gRPC server NORNICDB_QDRANT_GRPC_ENABLED
QdrantGRPCListenAddr :6334 gRPC listen address NORNICDB_QDRANT_GRPC_LISTEN_ADDR
QdrantGRPCMaxVectorDim 4096 Maximum vector dimension NORNICDB_QDRANT_GRPC_MAX_VECTOR_DIM
QdrantGRPCMaxBatchPoints 1000 Max points per upsert NORNICDB_QDRANT_GRPC_MAX_BATCH_POINTS
QdrantGRPCMaxTopK 1000 Max search results NORNICDB_QDRANT_GRPC_MAX_TOP_K

Architecture

Thin Translation Layer

The Qdrant gRPC package is a thin translation layer that maps Qdrant RPCs to NornicDB internals:

┌─────────────────────────────────────────────────────────────┐
│                     Qdrant SDK                               │
│              (Python, Go, Rust, etc.)                        │
└─────────────────────────────────────────────────────────────┘
                           │ gRPC (protobuf)
                           ▼
┌─────────────────────────────────────────────────────────────┐
│              pkg/qdrantgrpc (TRANSLATION LAYER)              │
│                                                              │
│   ┌─────────────────┐  ┌──────────────┐  ┌────────────────┐ │
│   │ CollectionsService│ │PointsService │ │ HealthService  │ │
│   │  (6 RPCs)        │ │  (16 RPCs)    │ │  (1 RPC)       │ │
│   └────────┬─────────┘ └──────┬────────┘ └────────────────┘ │
│            │                  │                              │
│            │  Type conversion │  Type conversion             │
│            ▼                  ▼                              │
└─────────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│                     NornicDB Core                            │
│  ┌───────────────┐  ┌───────────────┐  ┌─────────────────┐  │
│  │ storage.Engine│  │ search.Service│  │ SchemaManager   │  │
│  │ (Nodes/Edges) │  │ (Vector Index)│  │ (Field Indexes) │  │
│  └───────────────┘  └───────────────┘  └─────────────────┘  │
└─────────────────────────────────────────────────────────────┘
Data Model Mapping
Qdrant Concept NornicDB Equivalent
Collection Metadata node (_QdrantCollection label)
Point Node with QdrantPoint + collection labels
PointId NodeID: qdrant:{collection}:{id}
Payload Node.Properties
Vector(s) Node.NamedEmbeddings (Qdrant unnamed vector stored under key "default")
Named Vectors Node.NamedEmbeddings[name]
Filter In-memory property filter
Key Benefits
  1. Single Source of Truth: Points are stored as standard NornicDB nodes
  2. Cross-Endpoint Search: Points added via Qdrant are searchable via /nornicdb/search
  3. Cypher Integration: Points can be queried via Cypher MATCH patterns
  4. Unified Indexing: search.Service maintains one vector index for all data

Distance Metrics

Qdrant Distance NornicDB Implementation
COSINE Dot product on normalized vectors
DOT Dot product
EUCLID Euclidean distance

Performance Considerations

Hot Path Optimizations
  • No JSON: Pure protobuf encoding/decoding
  • Batch operations: Bulk node creation
  • Direct storage access: Bypasses Cypher query layer for CRUD
  • Connection pooling: gRPC keepalive tuning
Limits for Safety

All limits are enforced to prevent OOM conditions:

  • Batch sizes capped to prevent large memory allocations
  • Payload sizes limited per point
  • Search result limits enforced

Testing

End-to-End (Core Server Integration)

This verifies the gRPC endpoint is correctly wired into the core server behind feature flags:

./scripts/qdrantgrpc_e2e.sh
# Run unit tests
go test ./pkg/qdrantgrpc/... -v

# Run with coverage
go test ./pkg/qdrantgrpc/... -coverprofile=coverage.out
go tool cover -html=coverage.out

# Current coverage: 73.9%

Implementation Tracking

See COMPAT.md for detailed implementation status.

License

Same license as NornicDB.

Documentation

Overview

Package qdrantgrpc provides Qdrant-compatible gRPC APIs for NornicDB.

This package enables existing Qdrant SDKs (Python, Go, Rust, etc.) to connect to NornicDB without modification by implementing the upstream Qdrant protobuf contract (package `qdrant`, pinned to v1.16.x).

NornicDB does not expose any additional “compat” gRPC contract for Qdrant. The only public Qdrant surface is the upstream Qdrant protobuf contract.

This package integrates with the existing search.Service to ensure:

  • Points added via Qdrant gRPC are searchable via /nornicdb/search
  • Points added via Cypher are searchable via Qdrant gRPC
  • A single unified vector index is maintained

Compatibility

The upstream Qdrant SDK surface currently implements the core methods used by qdrant-client (Python) and other SDKs for typical vector workloads:

  • Collections: Create, Get, List, Delete, Update, CollectionExists
  • Points: Upsert, Get, Delete, Count, Search, Scroll, payload ops, vector ops

Additional upstream Qdrant RPCs can be added incrementally as needed.

Data Model Mapping

  • Qdrant Collection → NornicDB database namespace (collection = database)
  • Qdrant Point → NornicDB Node with embeddings in NamedEmbeddings (supports named vectors)
  • Qdrant Payload → NornicDB Node properties
  • Qdrant PointId → NornicDB NodeID (prefixed: qdrant:point:<id>, scoped by database namespace)

Feature Flag

The Qdrant gRPC endpoint is controlled by a feature flag:

  • Environment: NORNICDB_QDRANT_GRPC_ENABLED=true
  • Config: config.Features.QdrantGRPCEnabled = true

Usage

// Create server with NornicDB storage and search
cfg := qdrantgrpc.DefaultConfig()
srv, err := qdrantgrpc.NewServer(cfg, storage, registry, searchService, authenticator)
if err != nil {
	log.Fatal(err)
}

// Start listening
if err := srv.Start(); err != nil {
	log.Fatal(err)
}
defer srv.Stop()

ELI12

Think of this like a translator at a restaurant:

  • Qdrant SDKs "speak Qdrant language" (their API)
  • NornicDB "speaks NornicDB language" (its internal API)
  • This server translates between them so they can communicate
  • When a Qdrant client asks to store a vector, we translate it to NornicDB format
  • When NornicDB returns results, we translate back to Qdrant format

Package qdrantgrpc - In-memory vector index cache for Qdrant gRPC searches.

DEPRECATED: This endpoint-specific indexing cache is being phased out in favor of the unified IndexRegistry and NamedEmbeddings data model. The cache is kept as a fallback during migration but will be removed once IndexRegistry integration is stable.

This cache maintains per-collection, per-vector-name indexes to avoid falling back to storage scans when Qdrant collection dimensions differ from the DB's default embedding dimensions.

Index

Constants

View Source
const (
	// QdrantPointLabel is the label used to identify Qdrant point nodes within a collection database.
	QdrantPointLabel = "QdrantPoint"
)

Variables

View Source
var (
	// ErrCollectionNotFound indicates the requested Qdrant collection does not exist.
	// This includes databases that exist but do not contain the required _collection_meta node.
	ErrCollectionNotFound = errors.New("collection not found")
	// ErrInvalidCollection indicates the collection database exists but does not satisfy the metadata contract.
	ErrInvalidCollection = errors.New("invalid collection metadata")
)

Functions

This section is empty.

Types

type CollectionMeta

type CollectionMeta struct {
	Name       string
	Dimensions int
	Distance   qpb.Distance
	Status     qpb.CollectionStatus
}

CollectionMeta holds metadata about a Qdrant collection.

In the collection=database model, this metadata is stored in the collection database as the required `_collection_meta` node.

type CollectionStore

type CollectionStore interface {
	Create(ctx context.Context, name string, dims int, distance qpb.Distance) error
	Open(ctx context.Context, name string) (storage.Engine, *CollectionMeta, error)
	GetMeta(ctx context.Context, name string) (*CollectionMeta, error)
	List(ctx context.Context) ([]string, error)
	Drop(ctx context.Context, name string) error
	Exists(name string) bool
	PointCount(ctx context.Context, name string) (int64, error)
}

CollectionStore maps Qdrant collections to NornicDB database namespaces.

The implementation enforces the required _collection_meta node contract and does not support legacy layouts (shared namespace + label filtering).

func NewDatabaseCollectionStore

func NewDatabaseCollectionStore(dbManager *multidb.DatabaseManager, vecIndex *vectorIndexCache) (CollectionStore, error)

NewDatabaseCollectionStore creates a CollectionStore backed by DatabaseManager namespaces.

type CollectionsService

type CollectionsService struct {
	qpb.UnimplementedCollectionsServer
	// contains filtered or unexported fields
}

CollectionsService implements the Qdrant Collections gRPC service.

func NewCollectionsService

func NewCollectionsService(collections CollectionStore, vecIndex *vectorIndexCache, checker DatabaseAccessChecker) *CollectionsService

NewCollectionsService creates a new Collections service.

func (*CollectionsService) CollectionExists

func (*CollectionsService) Create

func (*CollectionsService) Delete

func (*CollectionsService) Get

func (*CollectionsService) List

func (*CollectionsService) Update

Update acknowledges the update request if the collection exists. NornicDB manages tuning parameters internally.

type Config

type Config struct {
	// ListenAddr is the address to listen on (e.g., ":6334")
	ListenAddr string

	// AllowVectorMutations controls whether Qdrant points operations are allowed to
	// directly set/update/delete stored vectors.
	//
	// When NornicDB-managed embeddings are enabled, operators typically want to
	// prevent external clients from overwriting embeddings via the Qdrant API.
	// In that mode, vector mutation endpoints return FailedPrecondition.
	//
	// When NornicDB-managed embeddings are disabled, set this to true to allow
	// Qdrant clients to fully manage vectors.
	AllowVectorMutations bool

	// MaxVectorDim is the maximum allowed vector dimension
	MaxVectorDim int

	// MaxBatchPoints is the maximum points per upsert batch
	MaxBatchPoints int

	// MaxPayloadBytes is the maximum payload size per point
	MaxPayloadBytes int

	// MaxTopK is the maximum results per search
	MaxTopK int

	// MaxFilterClauses is the maximum filter conditions
	MaxFilterClauses int

	// RequestTimeout is the default deadline for requests
	RequestTimeout time.Duration

	// MaxConcurrentStreams per connection
	MaxConcurrentStreams uint32

	// MaxRecvMsgSize in bytes
	MaxRecvMsgSize int

	// MaxSendMsgSize in bytes
	MaxSendMsgSize int

	// EnableReflection enables gRPC server reflection
	EnableReflection bool

	// SnapshotDir is the directory for storing snapshots
	SnapshotDir string

	// EmbedQuery, when set, allows the Qdrant Query API to accept text/inference
	// inputs (e.g. VectorInput.Document) and have NornicDB embed the query text.
	//
	// If nil, those query variants return FailedPrecondition.
	EmbedQuery func(ctx context.Context, text string) ([]float32, error)

	// MethodPermissions optionally overrides the default RBAC requirements for
	// specific RPCs.
	//
	// Keys are of the form "<Service>/<Method>", using the short gRPC service name:
	//   - "Collections/Create"
	//   - "Points/Upsert"
	//   - "Snapshots/List"
	//   - "ServerReflection/ServerReflectionInfo"
	//
	// If a request's method is not found in either this map or the built-in
	// defaults, the request is denied (default-deny).
	MethodPermissions map[string]auth.Permission

	// DatabaseAccessModeResolver, when set, enables per-database (per-collection) RBAC.
	// Collection name = database name. Called with the principal's roles from context;
	// CanAccessDatabase(collectionName) is checked before opening the collection.
	DatabaseAccessModeResolver func(roles []string) auth.DatabaseAccessMode
	// ResolvedAccessResolver, when set, is used for write RPCs: ResolvedAccess.Write
	// for (roles, collectionName) must be true or the request is denied.
	ResolvedAccessResolver func(roles []string, dbName string) auth.ResolvedAccess
}

Config holds configuration for the Qdrant gRPC server.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns sensible defaults for the Qdrant gRPC server.

type DatabaseAccessChecker

type DatabaseAccessChecker interface {
	// AllowDatabaseAccess returns nil if the principal in ctx may access the database (read-only if write is false, write if write is true).
	AllowDatabaseAccess(ctx context.Context, database string, write bool) error
	// VisibleDatabases returns the subset of candidates that the principal may see (e.g. for List filtering).
	VisibleDatabases(ctx context.Context, candidates []string) ([]string, error)
}

DatabaseAccessChecker is used by Points, Collections, and Snapshots services to enforce per-database (per-collection) RBAC. Collection name = database name.

type PointsService

type PointsService struct {
	qpb.UnimplementedPointsServer
	// contains filtered or unexported fields
}

PointsService implements the upstream Qdrant Points gRPC service (package `qdrant`). It stores points as NornicDB nodes and (optionally) indexes them via search.Service.

func NewPointsService

func NewPointsService(config *Config, collections CollectionStore, searchProvider SearchServiceProvider, vecIndex *vectorIndexCache, checker DatabaseAccessChecker) *PointsService

func (*PointsService) ClearPayload

func (*PointsService) Count

func (*PointsService) CreateFieldIndex

func (*PointsService) Delete

func (*PointsService) DeleteFieldIndex

func (*PointsService) DeletePayload

func (*PointsService) DeleteVectors

func (*PointsService) Get

func (*PointsService) OverwritePayload

func (*PointsService) Query

Query implements Qdrant's universal query API for the most common variant: Query(nearest = VectorInput).

This enables text/inference-shaped queries via VectorInput.Document when Config.EmbedQuery is provided.

func (*PointsService) QueryBatch

func (*PointsService) Recommend

func (*PointsService) RecommendBatch

func (*PointsService) Scroll

func (*PointsService) Search

func (*PointsService) SearchBatch

func (*PointsService) SearchGroups

func (*PointsService) SetPayload

func (*PointsService) UpdateVectors

func (*PointsService) Upsert

Upsert inserts or overwrites points. If a point exists, its payload/vectors are replaced.

type SearchServiceProvider

type SearchServiceProvider func(database string, store storage.Engine) (*search.Service, error)

SearchServiceProvider returns a search service configured for the provided database namespace. When nil, Qdrant point writes still persist but do not update NornicDB search indexes.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the Qdrant-compatible gRPC server.

func NewServer

func NewServer(config *Config, collections CollectionStore, baseStorage storage.Engine, searchProvider SearchServiceProvider, authenticator *auth.Authenticator) (*Server, error)

NewServer creates a new Qdrant gRPC server.

Parameters:

  • config: Server configuration (use DefaultConfig() for sensible defaults)
  • collections: Collection store (maps collections to database namespaces)
  • baseStorage: Base storage engine (un-namespaced); used for full snapshots/backups
  • searchProvider: Optional per-database search service provider
  • authenticator: Authentication for gRPC requests (can be nil if auth disabled)

Returns the server instance ready to Start().

func NewServerWithDatabaseManager

func NewServerWithDatabaseManager(config *Config, dbManager *multidb.DatabaseManager, baseStorage storage.Engine, searchProvider SearchServiceProvider, authenticator *auth.Authenticator) (*Server, error)

NewServerWithPersistentRegistry creates a server with a persistent collection registry. This is the recommended way to create a production Qdrant gRPC server.

The persistent registry:

  • Persists collection metadata to storage
  • Loads existing collections on startup

The search service (if provided):

  • Indexes points for unified vector search
  • Enables cross-endpoint search (Qdrant gRPC + /nornicdb/search)

Example:

storage := badger.NewEngine("./data")
searchSvc := search.NewService(storage)
authenticator := auth.NewAuthenticator(auth.DefaultAuthConfig())
srv, registry, err := qdrantgrpc.NewServerWithPersistentRegistry(nil, storage, searchSvc, authenticator)
if err != nil {
	log.Fatal(err)
}
defer registry.Close()
srv.Start()

NewServerWithDatabaseManager wires a Qdrant gRPC server against NornicDB's DatabaseManager.

Collections are created as database namespaces and must contain the required _collection_meta node.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the server's listen address.

func (*Server) AllowDatabaseAccess

func (s *Server) AllowDatabaseAccess(ctx context.Context, database string, write bool) error

AllowDatabaseAccess implements DatabaseAccessChecker. Returns PermissionDenied if the principal may not access the database.

func (*Server) CollectionStore

func (s *Server) CollectionStore() CollectionStore

CollectionStore returns the configured collection store.

func (*Server) IsRunning

func (s *Server) IsRunning() bool

IsRunning returns whether the server is currently running.

func (*Server) RegisterAdditionalServices

func (s *Server) RegisterAdditionalServices(fn func(*grpc.Server)) error

RegisterAdditionalServices registers additional gRPC services on the same server. This must be called before Start().

func (*Server) Start

func (s *Server) Start() error

Start begins listening for gRPC connections.

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down the server.

func (*Server) VisibleDatabases

func (s *Server) VisibleDatabases(ctx context.Context, candidates []string) ([]string, error)

VisibleDatabases implements DatabaseAccessChecker. Returns the subset of candidates the principal may see.

type SnapshotsService

type SnapshotsService struct {
	qpb.UnimplementedSnapshotsServer
	// contains filtered or unexported fields
}

SnapshotsService implements the Qdrant Snapshots gRPC service. It maps to NornicDB's storage.Snapshot and BadgerEngine.Backup functionality.

func NewSnapshotsService

func NewSnapshotsService(config *Config, collections CollectionStore, baseStorage storage.Engine, snapshotDir string, checker DatabaseAccessChecker) *SnapshotsService

NewSnapshotsService creates a new Snapshots service. snapshotDir is the directory where snapshots will be stored.

func (*SnapshotsService) Create

Create creates a new snapshot of a collection. Maps to: Export collection nodes as JSON snapshot

func (*SnapshotsService) CreateFull

CreateFull creates a full storage snapshot (all collections). Maps to: BadgerEngine.Backup or WAL.CreateSnapshot for all data

func (*SnapshotsService) Delete

Delete removes a snapshot. Maps to: Delete snapshot file

func (*SnapshotsService) DeleteFull

DeleteFull removes a full storage snapshot. Maps to: Delete full snapshot file

func (*SnapshotsService) List

List lists all snapshots for a collection. Maps to: List files in collection snapshot directory

func (*SnapshotsService) ListFull

ListFull lists all full storage snapshots. Maps to: List files in full snapshot directory

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL