router

package
v1.35.10 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package router provides an abstraction for determining the optimal routing plans for reads and writes within a Weaviate cluster. It handles logic around sharding, replication, and consistency, helping determine which nodes and shards (replicas) should be queried for a given operation.

The Router interface is implemented by single-tenant and multi-tenant routers, depending on the system's configuration. Use NewBuilder to create the appropriate router based on whether partitioning is enabled.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder added in v1.32.0

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

Builder provides a builder for creating router instances based on configuration. Use NewBuilder() with all required parameters, then call Build() to get the appropriate Router implementation, either a multi-tenant router or a single tenant router. The multi-tenant router will use the tenant name as the partitioning key to identify a specific tenant's partitioning.

func NewBuilder added in v1.32.0

func NewBuilder(
	collection string,
	partitioningEnabled bool,
	nodeSelector cluster.NodeSelector,
	schemaGetter schema.SchemaGetter,
	schemaReader schema.SchemaReader,
	replicationFSMReader replicationTypes.ReplicationFSMReader,
) *Builder

NewBuilder creates a new Builder with the provided configuration.

Parameters:

  • collection: the name of the collection that this router will handle.
  • partitioningEnabled: true for multi-tenant mode, false for single-tenant mode.
  • nodeSelector: provides cluster node state information and hostnames.
  • schemaGetter: provides collection schemas, sharding states, and tenant information.
  • schemaReader: provides shard replica (or node names) metadata.
  • replicationFSMReader: provides replica state information for replication consistency.

Returns:

  • *Builder: a new builder instance ready to build the appropriate router.

func (*Builder) Build added in v1.32.0

func (b *Builder) Build() types.Router

Build builds and returns the appropriate router implementation based on the partitioning configuration.

Returns:

  • Router: a concrete router implementation (*multiTenantRouter or *singleTenantRouter) that implements the Router interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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