shards

package
v0.0.0-...-fba379b Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Shards []Shard `json:"shards"`
}

Config represents the data inside of the shard config file with multiple shard entries

func ParseConfigFile

func ParseConfigFile(path string) (*Config, error)

ParseConfigFile opens the shards file and parses the json information into the Config struct.

func (*Config) ParseConfigShards

func (c *Config) ParseConfigShards(shardName string) (*Shards, error)

ParseConfigShards returns a Shards struct from the config given a shard name

type Shard

type Shard struct {
	Index   int    `json:"index"`
	Name    string `json:"name"`
	Address string `json:"address"`
}

Shard represents the config entry for a single shard

type Shards

type Shards struct {
	Amount    int
	Index     int
	Addresses map[int]string
}

Shards represents the configuration of a server, but it also includes the amount of shards and the address listings.

func (*Shards) GetShardIndex

func (s *Shards) GetShardIndex(key string) int

GetShardIndex is the sharding function which desides in which the shard the key-value should go into

Jump to

Keyboard shortcuts

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