libconfig

package
v0.0.0-...-8dfc455 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddServer

func AddServer(group string, entry string)

AddServer adds an entry to our server-list.

func Groups

func Groups() []string

Groups returns the name of each group we have defined.

func InitServers

func InitServers()

InitServers inititalizes our list of servers.

func ServersLoad

func ServersLoad(file string)

ServersLoad reads/parses the list of servers from the specified file.

Types

type BlobServer

type BlobServer struct {
	Location string
	Group    string
}

BlobServer represents a blob-server.

The blob-server has:

  • A location (host:port).
  • A group to which it belongs.

func GroupMembers

func GroupMembers(group string) []BlobServer

GroupMembers returns the members of the given group

func OrderedServers

func OrderedServers() []BlobServer

OrderedServers returns a priority-ordered list of servers which will be used for uploads/downloads.

Remember that we have potentially N groups. We want to pick the first server from each group, then the second server from each group, etc, etc.

Given input

group:1 host:host1
group:1 host:host2
group:2 host:host1
group:2 host:host2
group:3 host:host1
group:3 host:host2
group:3 host:host3

The output should be:

group:1 host1
group:2 host1
group:3 host1
group:1 host2
group:2 host2
group:3 host2
group:3 host3

This means we take three accesses to hit a server in each group, rather than five. Similar savings will add up when there are more groups and servers.

func Servers

func Servers() []BlobServer

Servers returns the list of servers we've discovered.

Jump to

Keyboard shortcuts

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