Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHostRegistry ¶
func NewHostRegistry() *hostRegistry
func NewJournalCatalog ¶
func NewJournalCatalog() *journalCatalog
Types ¶
type ChunkHosts ¶
type HostInfo ¶
type HostInfo struct { // RpcAddr the Rpc Address the host can be connected by RpcAddr cluster.HostAddr `json:"rpcAddr"` }
HostInfo struct describes a Host information
type HostRegistry ¶
type HostRegistry interface { // Id returns the cluster HostId which was choosen for the localhost Id() cluster.HostId // Hosts returns map of all known hosts, including the current one. Hosts(ctx context.Context) (HostsMap, error) // Lease returns the lease, acquired for the host registry Lease() kv.Lease }
HostRegistry interface allows to have an access to all known cluster hosts
type HostRegistryConfig ¶
type HostRegistryConfig interface { // HostId defines the cluster HostId to be registered. Value 0 means // it must be choosen to be unique HostId() cluster.HostId // Localhost defines params of the local host to be registered Localhost() HostInfo // LeaseTTL defines the lease timeout LeaseTTL() time.Duration // RegisterTimeout defines first register timeout 0 means forewer RegisterTimeout() time.Duration }
HostRegistryConfig interface is used for configuring new HostRegistry
type JournalCatalog ¶
type JournalCatalog interface { // GetJournalInfo returns information known for a journal by its name GetJournalInfo(ctx context.Context, jname string) (JournalInfo, error) // ReportLocalChunks reports information about local chunks. ReportLocalChunks(ctx context.Context, jname string, chunks []chunk.Id) error }
JournalCatalog allows to access to the journals information known in the cluster The information reported by every host will be associated with the process Lease (HostRegistry.Lease()) and it will be removed from the storage as soon, as the process is down.
Every journal is represented by multiple records in the kv.Storage by the following key schema:
J/<journal>/<Host>
So a journal is a set of records. When the host is down, it's records will be disappeared due to the record's lease expiration
type JournalInfo ¶
type JournalInfo struct { // Journal is the name of the journal for which the information is collected Journal string // LocalChunks contains list of chunks available (reported) from the host LocalChunks []chunk.Id // Chunks contains map of chunks that are reported by other hosts for the journal Chunks map[chunk.Id]ChunkHosts }
JournalInfo contains information about a journal, collected by all hosts