configprovider

package
v4.15.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const HASHRANGE_END = (1 << 32)
View Source
const True = "true"

Variables

View Source
var FullMashRange = MashRange{
	Start: 0,
	End:   HASHRANGE_END,
}

Functions

func LoadPoolNames

func LoadPoolNames(ctx context.Context, cl *client.Client, pfx string) (cold string, hot string, journal string, err error)

Types

type ClusterConfiguration

type ClusterConfiguration interface {
	// Returns true if we hold the write lock for the given uuid. Returns false
	// if we do not have the write lock, or we are trying to get rid of the write
	// lock
	NodeName() string
	WeHoldWriteLockFor(uuid []byte) bool

	OurRanges() (active MashRange, proposed MashRange)
	WatchMASHChange(w func(flushComplete chan struct{}, activeRange MashRange, proposedRange MashRange))

	PeerHTTPAdvertise(nodename string) ([]string, error)
	PeerGRPCAdvertise(nodename string) ([]string, error)
	GetCachedClusterState() *ClusterState
	//	MASHNumber() int64
	// Called when the node knows it is faulty (generally pre-panic). This
	// removes the delay that would normally accompany the lease expiry
	Fault(fz string, args ...interface{})

	// Get a tunable, and watch it for all future changes. Only meant to be
	// used by Rez
	WatchTunable(name string, onchange func(v string)) error

	GetEtcdClient() *etcd.Client

	BeginClusterDaemons()
}

type ClusterState

type ClusterState struct {
	Revision       int64
	Members        map[string]*Member
	Mashes         map[int64]map[string]*MashRange
	Leader         string
	LeaderRevision int64
	// contains filtered or unexported fields
}

func QueryClusterState

func QueryClusterState(ctx context.Context, cl *client.Client, pfx string) (*ClusterState, error)

func (*ClusterState) ActiveMASH

func (s *ClusterState) ActiveMASH() *MASHMap

func (*ClusterState) ActiveMembers

func (s *ClusterState) ActiveMembers() int

func (*ClusterState) GapPercentage

func (cs *ClusterState) GapPercentage() float64

func (*ClusterState) HasLeader

func (s *ClusterState) HasLeader() bool

func (*ClusterState) Healthy

func (cs *ClusterState) Healthy() bool

func (*ClusterState) IdealLeader

func (s *ClusterState) IdealLeader() uint32

func (*ClusterState) IdealMash

func (s *ClusterState) IdealMash() *MASHMap

func (*ClusterState) MashAt

func (s *ClusterState) MashAt(v int64) *MASHMap

func (*ClusterState) ProposedMASH

func (s *ClusterState) ProposedMASH() *MASHMap

func (*ClusterState) ProposedMashNumber

func (s *ClusterState) ProposedMashNumber() (proposed int64, active int64, allmax bool)

Highest map num, all at max

func (*ClusterState) String

func (cs *ClusterState) String() string

type Configuration

type Configuration interface {
	ClusterEnabled() bool
	ClusterPrefix() string
	ClusterEtcdEndpoints() []string
	StorageCephConf() string
	StorageFilepath() string
	StorageCephDataPool() string
	StorageCephHotPool() string
	StorageCephJournalPool() string
	HttpEnabled() bool
	HttpListen() string
	HttpAdvertise() []string
	GRPCEnabled() bool
	GRPCListen() string
	GRPCAdvertise() []string
	BlockCache() int
	RadosReadCache() int
	RadosWriteCache() int

	// Note that these are "live" and called in the hotpath, so buffer them
	CoalesceMaxPoints() int
	CoalesceMaxInterval() int
}

func LoadEtcdConfig

func LoadEtcdConfig(cfg Configuration, overrideNodename string) (Configuration, error)

The file config is loaded first, and used to bootstrap etcd if requred

func LoadFileConfig

func LoadFileConfig(path string) (Configuration, error)

type FileConfig

type FileConfig struct {
	Cluster struct {
		Prefix       string
		EtcdEndpoint []string
		Enabled      bool
	}
	Http struct {
		Listen    string
		Advertise []string
		Enabled   bool
	}
	Grpc struct {
		Listen    string
		Advertise []string
		Enabled   bool
	}
	Storage struct {
		Filepath        string
		CephDataPool    string
		CephHotPool     string
		CephJournalPool string
		CephConf        string
	}
	Cache struct {
		BlockCache      int
		RadosWriteCache int
		RadosReadCache  int
	}
	Debug struct {
		Cpuprofile  bool
		Heapprofile bool
	}
	Coalescence struct {
		MaxPoints int
		Interval  int
	}
}

func (*FileConfig) BlockCache

func (c *FileConfig) BlockCache() int

func (*FileConfig) ClusterEnabled

func (c *FileConfig) ClusterEnabled() bool

func (*FileConfig) ClusterEtcdEndpoints

func (c *FileConfig) ClusterEtcdEndpoints() []string

func (*FileConfig) ClusterPrefix

func (c *FileConfig) ClusterPrefix() string

func (*FileConfig) CoalesceMaxInterval

func (c *FileConfig) CoalesceMaxInterval() int

func (*FileConfig) CoalesceMaxPoints

func (c *FileConfig) CoalesceMaxPoints() int

func (*FileConfig) GRPCAdvertise

func (c *FileConfig) GRPCAdvertise() []string

func (*FileConfig) GRPCEnabled

func (c *FileConfig) GRPCEnabled() bool

func (*FileConfig) GRPCListen

func (c *FileConfig) GRPCListen() string

func (*FileConfig) HttpAdvertise

func (c *FileConfig) HttpAdvertise() []string

func (*FileConfig) HttpEnabled

func (c *FileConfig) HttpEnabled() bool

func (*FileConfig) HttpListen

func (c *FileConfig) HttpListen() string

func (*FileConfig) RadosReadCache

func (c *FileConfig) RadosReadCache() int

func (*FileConfig) RadosWriteCache

func (c *FileConfig) RadosWriteCache() int

func (*FileConfig) StorageCephConf

func (c *FileConfig) StorageCephConf() string

func (*FileConfig) StorageCephDataPool

func (c *FileConfig) StorageCephDataPool() string

func (*FileConfig) StorageCephHotPool

func (c *FileConfig) StorageCephHotPool() string

func (*FileConfig) StorageCephJournalPool

func (c *FileConfig) StorageCephJournalPool() string

func (*FileConfig) StorageFilepath

func (c *FileConfig) StorageFilepath() string

type MASHMap

type MASHMap struct {
	Ranges      []*MashRange
	Hashes      []uint32
	Nodenames   []string
	Weights     []int64
	TotalWeight int64
	// contains filtered or unexported fields
}

func (*MASHMap) CompatibleIntermediateMash

func (currentMash *MASHMap) CompatibleIntermediateMash(idealMash *MASHMap) *MASHMap

func (*MASHMap) Equivalent

func (mm *MASHMap) Equivalent(rhs *MASHMap) bool

Return true if these maps are identical

func (*MASHMap) Gap

func (mm *MASHMap) Gap() int64

func (*MASHMap) IntersectWithFreeSpace

func (mm *MASHMap) IntersectWithFreeSpace(r *MashRange, excluding uint32) *MashRange

Return the range that is the intersection of mashRange and the free space in mm if you remove 'excluding' (the hash of a node)

func (*MASHMap) Len

func (mm *MASHMap) Len() int

func (*MASHMap) Less

func (mm *MASHMap) Less(i, j int) bool

func (*MASHMap) String

func (mm *MASHMap) String() string

func (*MASHMap) Swap

func (mm *MASHMap) Swap(i, j int)

type MashRange

type MashRange struct {
	Start int64
	End   int64
}

func UnpackMashRange

func UnpackMashRange(b []byte) *MashRange

func (*MashRange) Equal

func (mr *MashRange) Equal(rhs *MashRange) bool

func (*MashRange) Pack

func (mr *MashRange) Pack() []byte

func (*MashRange) SuperSetOfUUID

func (mr *MashRange) SuperSetOfUUID(uuid []byte) bool

func (*MashRange) Union

func (mr *MashRange) Union(rhs *MashRange) (bool, *MashRange)

type Member

type Member struct {
	Nodename string
	Enabled  bool
	In       bool
	Hash     uint32
	//Zero if not present, but also if present and zero (during startup)
	Active                  int64
	Weight                  int64
	ReadWeight              float64
	AdvertisedEndpointsHTTP []string
	AdvertisedEndpointsGRPC []string
}

func (*Member) IsIn

func (m *Member) IsIn() bool

Jump to

Keyboard shortcuts

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