model

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterConfig

type ClusterConfig struct {
	Namespaces []NamespaceConfig `json:"namespaces" yaml:"namespaces"`
	Servers    []ServerAddress   `json:"servers" yaml:"servers"`
}

type ClusterStatus

type ClusterStatus struct {
	Namespaces       map[string]NamespaceStatus `json:"namespaces" yaml:"namespaces"`
	ShardIdGenerator int64                      `json:"shardIdGenerator" yaml:"shardIdGenerator"`
	ServerIdx        uint32                     `json:"serverIdx" yaml:"serverIdx"`
}

func NewClusterStatus

func NewClusterStatus() *ClusterStatus

func (ClusterStatus) Clone

func (c ClusterStatus) Clone() *ClusterStatus

type Int32HashRange

type Int32HashRange struct {
	// The minimum inclusive hash that the shard can contain
	Min uint32 `json:"min"`

	// The maximum inclusive hash that the shard can contain
	Max uint32 `json:"max"`
}

func (Int32HashRange) Clone

func (sm Int32HashRange) Clone() Int32HashRange

type NamespaceConfig

type NamespaceConfig struct {
	Name              string `json:"name" yaml:"name"`
	InitialShardCount uint32 `json:"initialShardCount" yaml:"initialShardCount"`
	ReplicationFactor uint32 `json:"replicationFactor" yaml:"replicationFactor"`
}

type NamespaceStatus

type NamespaceStatus struct {
	ReplicationFactor uint32                  `json:"replicationFactor" yaml:"replicationFactor"`
	Shards            map[int64]ShardMetadata `json:"shards" yaml:"shards"`
}

func (NamespaceStatus) Clone

func (n NamespaceStatus) Clone() NamespaceStatus

type ServerAddress

type ServerAddress struct {
	// Public is the endpoint that is advertised to clients
	Public string `json:"public" yaml:"public"`

	// Internal is the endpoint for server->server RPCs
	Internal string `json:"internal" yaml:"internal"`
}

type ShardMetadata

type ShardMetadata struct {
	Status         ShardStatus     `json:"status" yaml:"status"`
	Term           int64           `json:"term" yaml:"term"`
	Leader         *ServerAddress  `json:"leader" yaml:"leader"`
	Ensemble       []ServerAddress `json:"ensemble" yaml:"ensemble"`
	RemovedNodes   []ServerAddress `json:"removedNodes" yaml:"removedNodes"`
	Int32HashRange Int32HashRange  `json:"int32HashRange" yaml:"int32HashRange"`
}

func (ShardMetadata) Clone

func (sm ShardMetadata) Clone() ShardMetadata

type ShardStatus

type ShardStatus uint16
const (
	ShardStatusUnknown ShardStatus = iota
	ShardStatusSteadyState
	ShardStatusElection
	ShardStatusDeleting
)

func (ShardStatus) MarshalJSON

func (s ShardStatus) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (ShardStatus) String

func (s ShardStatus) String() string

func (*ShardStatus) UnmarshalJSON

func (s *ShardStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a quoted json string to the enum value.

Jump to

Keyboard shortcuts

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