Help us shape the future of Go! Take the 2026 Go Developer Survey

topology

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDialTimeout = 10 * time.Second

Variables

This section is empty.

Functions

Types

type ClientOptions

type ClientOptions struct {
	// BaseURL specifies the base URL to send requests to. Use the h2c:// scheme to use H2C.
	BaseURL string

	// DialTimeout specifies the maximum amount of time to dial the topology server in a request.
	// If unspecified, this will be [DefaultDialTimeout].
	DialTimeout time.Duration
}

type LevelDBStorage

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

LevelDBStorage implements topology storage on top of LevelDB.

func NewLevelDBStorage

func NewLevelDBStorage(db *leveldb.DB) *LevelDBStorage

NewLevelDBStorage creates a new LevelDB-backed storage engine.

func (*LevelDBStorage) Get

Get implements topology.Storage.

func (*LevelDBStorage) List

func (s *LevelDBStorage) List() ([]*topologypb.ServerEntry, error)

List implements topology.Storage.

func (*LevelDBStorage) Put

func (s *LevelDBStorage) Put(id uint16, server *topologypb.ServerEntry) error

Put implements topology.Storage.

type MemoryStorage

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

MemoryStorage implements topology storage on top of memory. MemoryStorage defensively deep-copies all protobufs to prevent any pointers from being shared amongst users and the storage layers, similar to a database engine that would require marshalling and unmarshalling.

func NewMemoryStorage

func NewMemoryStorage(entries []*topologypb.ServerEntry) *MemoryStorage

NewMemoryStorage creates a new memory store with the provided servers.

func (*MemoryStorage) Get

Get implements topology.Storage.

func (*MemoryStorage) List

func (s *MemoryStorage) List() ([]*topologypb.ServerEntry, error)

List implements topology.Storage.

func (*MemoryStorage) Put

func (s *MemoryStorage) Put(id uint16, entry *topologypb.ServerEntry) error

Put implements topology.Storage.

type Server

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

Server implements TopologyServiceServer.

func NewServer

func NewServer(storage Storage) *Server

NewServer creates a new Topology server.

func (*Server) AddServer

AddServer implements TopologyServiceServer.

func (*Server) GetServer

GetServer implements TopologyServiceServer.

func (*Server) ListServers

ListServers implements TopologyServiceServer.

type Storage

type Storage interface {
	Get(id uint16) (*topologypb.ServerEntry, error)
	Put(id uint16, server *topologypb.ServerEntry) error
	List() ([]*topologypb.ServerEntry, error)
}

Storage implementations implement a storage layer for the topology.

Jump to

Keyboard shortcuts

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