topology

package
v0.0.0-...-7a0127b Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: PostgreSQL Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RouterToDB

func RouterToDB(r *Router) *qdb.Router

RouterToDB converts a Router object to a qdb.Router object. It creates a new qdb.Router object and copies the ID, Address, and State fields from the input Router object. The converted qdb.Router object is then returned.

Parameters:

  • r: The Router object to convert.

Returns:

  • *qdb.Router: The converted qdb.Router object.

func RouterToProto

func RouterToProto(r *Router) *protos.Router

RouterToProto converts a Router object to a protos.Router object. It takes a pointer to a Router object as input and returns a pointer to a protos.Router object. The function maps the fields of the Router object to the corresponding fields of the protos.Router object. The status field of the Router object is converted to a protos.RouterStatus enum value.

Parameters:

  • r: A pointer to the Router object to convert.

Returns:

  • *protos.Router: A pointer to the converted protos.Router object.

Types

type Router

type Router struct {
	ID      string
	Address string
	State   qdb.RouterState
}

func RouterFromProto

func RouterFromProto(r *protos.Router) *Router

RouterFromProto converts a protobuf Router object to a Router struct. It takes a pointer to a protos.Router object as input and returns a pointer to a Router object. The function maps the fields of the protos.Router object to the corresponding fields of the Router object. The status field of the protos.Router object is converted to a qdb.RouterState enum value.

Parameters:

  • r: A pointer to the protos.Router object to convert.

Returns:

  • *Router: A pointer to the converted Router object.

type RouterMgr

type RouterMgr interface {
	RegisterRouter(ctx context.Context, r *Router) error
	ListRouters(ctx context.Context) ([]*Router, error)
	UnregisterRouter(ctx context.Context, id string) error
	SyncRouterMetadata(ctx context.Context, router *Router) error
	SyncRouterCoordinatorAddress(ctx context.Context, router *Router) error
	UpdateCoordinator(ctx context.Context, address string) error
	GetCoordinator(ctx context.Context) (string, error)
}

type Shard

type Shard struct {
	ID    string
	Hosts []string
}

func NewShard

func NewShard(ID string, hosts []string) *Shard

NewShard creates a new Shard instance with the specified ID and hosts. It returns a pointer to the created Shard.

Parameters:

  • ID: The ID of the shard.
  • hosts: The list of hosts that the shard is distributed across.

Returns:

  • *Shard: A pointer to the created Shard.

Jump to

Keyboard shortcuts

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