Documentation ¶
Index ¶
- Constants
- Variables
- func MockedMesh() *mockedMesh
- func New(userConfig Config) *memberlistMesh
- type Channel
- type ComputeUsage
- func (*ComputeUsage) Descriptor() ([]byte, []int)
- func (m *ComputeUsage) GetCores() int64
- func (m *ComputeUsage) GetGoroutines() int64
- func (*ComputeUsage) ProtoMessage()
- func (m *ComputeUsage) Reset()
- func (m *ComputeUsage) String() string
- func (m *ComputeUsage) XXX_DiscardUnknown()
- func (m *ComputeUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ComputeUsage) XXX_Merge(src proto.Message)
- func (m *ComputeUsage) XXX_Size() int
- func (m *ComputeUsage) XXX_Unmarshal(b []byte) error
- type Config
- type Discoverer
- type FullState
- func (*FullState) Descriptor() ([]byte, []int)
- func (m *FullState) GetParts() []*Part
- func (*FullState) ProtoMessage()
- func (m *FullState) Reset()
- func (m *FullState) String() string
- func (m *FullState) XXX_DiscardUnknown()
- func (m *FullState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FullState) XXX_Merge(src proto.Message)
- func (m *FullState) XXX_Size() int
- func (m *FullState) XXX_Unmarshal(b []byte) error
- type Layer
- type MemoryUsage
- func (*MemoryUsage) Descriptor() ([]byte, []int)
- func (m *MemoryUsage) GetAlloc() uint64
- func (m *MemoryUsage) GetNumGC() uint32
- func (m *MemoryUsage) GetSys() uint64
- func (m *MemoryUsage) GetTotalAlloc() uint64
- func (*MemoryUsage) ProtoMessage()
- func (m *MemoryUsage) Reset()
- func (m *MemoryUsage) String() string
- func (m *MemoryUsage) XXX_DiscardUnknown()
- func (m *MemoryUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MemoryUsage) XXX_Merge(src proto.Message)
- func (m *MemoryUsage) XXX_Size() int
- func (m *MemoryUsage) XXX_Unmarshal(b []byte) error
- type Mesh
- type Metadata
- func (*Metadata) Descriptor() ([]byte, []int)
- func (m *Metadata) GetComputeUsage() *ComputeUsage
- func (m *Metadata) GetHostedServices() []*NodeService
- func (m *Metadata) GetHostname() string
- func (m *Metadata) GetID() string
- func (m *Metadata) GetLastAdded() int64
- func (m *Metadata) GetLastDeleted() int64
- func (m *Metadata) GetMemoryUsage() *MemoryUsage
- func (m *Metadata) GetRuntime() string
- func (m *Metadata) GetServices() []string
- func (m *Metadata) GetStarted() int64
- func (*Metadata) ProtoMessage()
- func (m *Metadata) Reset()
- func (m *Metadata) String() string
- func (m *Metadata) XXX_DiscardUnknown()
- func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Metadata) XXX_Merge(src proto.Message)
- func (m *Metadata) XXX_Size() int
- func (m *Metadata) XXX_Unmarshal(b []byte) error
- type NodeMeta
- func (*NodeMeta) Descriptor() ([]byte, []int)
- func (m *NodeMeta) GetID() string
- func (m *NodeMeta) GetServices() []*NodeService
- func (*NodeMeta) ProtoMessage()
- func (m *NodeMeta) Reset()
- func (m *NodeMeta) String() string
- func (m *NodeMeta) XXX_DiscardUnknown()
- func (m *NodeMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NodeMeta) XXX_Merge(src proto.Message)
- func (m *NodeMeta) XXX_Size() int
- func (m *NodeMeta) XXX_Unmarshal(b []byte) error
- type NodeService
- func (*NodeService) Descriptor() ([]byte, []int)
- func (m *NodeService) GetID() string
- func (m *NodeService) GetNetworkAddress() string
- func (m *NodeService) GetPeer() string
- func (*NodeService) ProtoMessage()
- func (m *NodeService) Reset()
- func (m *NodeService) String() string
- func (m *NodeService) XXX_DiscardUnknown()
- func (m *NodeService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NodeService) XXX_Merge(src proto.Message)
- func (m *NodeService) XXX_Size() int
- func (m *NodeService) XXX_Unmarshal(b []byte) error
- type Part
- func (*Part) Descriptor() ([]byte, []int)
- func (m *Part) GetData() []byte
- func (m *Part) GetKey() string
- func (*Part) ProtoMessage()
- func (m *Part) Reset()
- func (m *Part) String() string
- func (m *Part) XXX_DiscardUnknown()
- func (m *Part) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Part) XXX_Merge(src proto.Message)
- func (m *Part) XXX_Size() int
- func (m *Part) XXX_Unmarshal(b []byte) error
- type Peer
- type PeerMetadataList
- func (*PeerMetadataList) Descriptor() ([]byte, []int)
- func (m *PeerMetadataList) GetMetadatas() []*Metadata
- func (*PeerMetadataList) ProtoMessage()
- func (m *PeerMetadataList) Reset()
- func (m *PeerMetadataList) String() string
- func (m *PeerMetadataList) XXX_DiscardUnknown()
- func (m *PeerMetadataList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PeerMetadataList) XXX_Merge(src proto.Message)
- func (m *PeerMetadataList) XXX_Size() int
- func (m *PeerMetadataList) XXX_Unmarshal(b []byte) error
- type PeerStore
- type Service
- type ServiceConfig
- type ServiceLayer
- type State
- type SubscriptionSet
Constants ¶
View Source
const ( PeerCreated string = "peer_created" PeerUpdated string = "peer_updated" PeerDeleted string = "peer_deleted" )
Variables ¶
View Source
var ( ErrStateKeyAlreadySet = errors.New("specified key is already taken") ErrNodeNotFound = errors.New("specified node not found in mesh") )
View Source
var (
ErrPeerNotFound = errors.New("peer not found")
)
Functions ¶
func MockedMesh ¶
func MockedMesh() *mockedMesh
Types ¶
type Channel ¶
type Channel interface {
Broadcast(b []byte)
}
Channel allows clients to send messages for a specific state type that will be broadcasted in a best-effort manner.
type ComputeUsage ¶
type ComputeUsage struct { Cores int64 `protobuf:"varint,1,opt,name=Cores,proto3" json:"Cores,omitempty"` Goroutines int64 `protobuf:"varint,2,opt,name=Goroutines,proto3" json:"Goroutines,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ComputeUsage) Descriptor ¶
func (*ComputeUsage) Descriptor() ([]byte, []int)
func (*ComputeUsage) GetCores ¶
func (m *ComputeUsage) GetCores() int64
func (*ComputeUsage) GetGoroutines ¶
func (m *ComputeUsage) GetGoroutines() int64
func (*ComputeUsage) ProtoMessage ¶
func (*ComputeUsage) ProtoMessage()
func (*ComputeUsage) Reset ¶
func (m *ComputeUsage) Reset()
func (*ComputeUsage) String ¶
func (m *ComputeUsage) String() string
func (*ComputeUsage) XXX_DiscardUnknown ¶
func (m *ComputeUsage) XXX_DiscardUnknown()
func (*ComputeUsage) XXX_Marshal ¶
func (m *ComputeUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ComputeUsage) XXX_Merge ¶
func (m *ComputeUsage) XXX_Merge(src proto.Message)
func (*ComputeUsage) XXX_Size ¶
func (m *ComputeUsage) XXX_Size() int
func (*ComputeUsage) XXX_Unmarshal ¶
func (m *ComputeUsage) XXX_Unmarshal(b []byte) error
type Discoverer ¶
type FullState ¶
type FullState struct { Parts []*Part `protobuf:"bytes,1,rep,name=parts,proto3" json:"parts,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*FullState) Descriptor ¶
func (*FullState) ProtoMessage ¶
func (*FullState) ProtoMessage()
func (*FullState) XXX_DiscardUnknown ¶
func (m *FullState) XXX_DiscardUnknown()
func (*FullState) XXX_Marshal ¶
func (*FullState) XXX_Unmarshal ¶
type Layer ¶
type Layer interface { AddState(key string, state State) (Channel, error) DiscoverPeers(discovery PeerStore) Join(peers []string) Members() []*memberlist.Node Leave() }
Mesh represents the mesh state network, being able to broadcast state across the nodes.
type MemoryUsage ¶
type MemoryUsage struct { Alloc uint64 `protobuf:"varint,1,opt,name=Alloc,proto3" json:"Alloc,omitempty"` TotalAlloc uint64 `protobuf:"varint,2,opt,name=TotalAlloc,proto3" json:"TotalAlloc,omitempty"` Sys uint64 `protobuf:"varint,3,opt,name=Sys,proto3" json:"Sys,omitempty"` NumGC uint32 `protobuf:"varint,4,opt,name=NumGC,proto3" json:"NumGC,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*MemoryUsage) Descriptor ¶
func (*MemoryUsage) Descriptor() ([]byte, []int)
func (*MemoryUsage) GetAlloc ¶
func (m *MemoryUsage) GetAlloc() uint64
func (*MemoryUsage) GetNumGC ¶
func (m *MemoryUsage) GetNumGC() uint32
func (*MemoryUsage) GetSys ¶
func (m *MemoryUsage) GetSys() uint64
func (*MemoryUsage) GetTotalAlloc ¶
func (m *MemoryUsage) GetTotalAlloc() uint64
func (*MemoryUsage) ProtoMessage ¶
func (*MemoryUsage) ProtoMessage()
func (*MemoryUsage) Reset ¶
func (m *MemoryUsage) Reset()
func (*MemoryUsage) String ¶
func (m *MemoryUsage) String() string
func (*MemoryUsage) XXX_DiscardUnknown ¶
func (m *MemoryUsage) XXX_DiscardUnknown()
func (*MemoryUsage) XXX_Marshal ¶
func (m *MemoryUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MemoryUsage) XXX_Merge ¶
func (m *MemoryUsage) XXX_Merge(src proto.Message)
func (*MemoryUsage) XXX_Size ¶
func (m *MemoryUsage) XXX_Size() int
func (*MemoryUsage) XXX_Unmarshal ¶
func (m *MemoryUsage) XXX_Unmarshal(b []byte) error
type Mesh ¶
type Mesh interface { Join(hosts []string) Peers() PeerStore DialService(name string) (*grpc.ClientConn, error) DialAddress(service, id string, f func(*grpc.ClientConn) error) error RegisterService(name, address string) error Leave() }
Mesh represents the mesh discovery network.
type Metadata ¶
type Metadata struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` Hostname string `protobuf:"bytes,3,opt,name=Hostname,proto3" json:"Hostname,omitempty"` LastAdded int64 `protobuf:"varint,5,opt,name=LastAdded,proto3" json:"LastAdded,omitempty"` LastDeleted int64 `protobuf:"varint,6,opt,name=LastDeleted,proto3" json:"LastDeleted,omitempty"` MemoryUsage *MemoryUsage `protobuf:"bytes,7,opt,name=MemoryUsage,proto3" json:"MemoryUsage,omitempty"` ComputeUsage *ComputeUsage `protobuf:"bytes,8,opt,name=ComputeUsage,proto3" json:"ComputeUsage,omitempty"` Runtime string `protobuf:"bytes,9,opt,name=Runtime,proto3" json:"Runtime,omitempty"` HostedServices []*NodeService `protobuf:"bytes,10,rep,name=HostedServices,proto3" json:"HostedServices,omitempty"` Services []string `protobuf:"bytes,11,rep,name=Services,proto3" json:"Services,omitempty"` Started int64 `protobuf:"varint,12,opt,name=Started,proto3" json:"Started,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Metadata) Descriptor ¶
func (*Metadata) GetComputeUsage ¶
func (m *Metadata) GetComputeUsage() *ComputeUsage
func (*Metadata) GetHostedServices ¶
func (m *Metadata) GetHostedServices() []*NodeService
func (*Metadata) GetHostname ¶
func (*Metadata) GetLastAdded ¶
func (*Metadata) GetLastDeleted ¶
func (*Metadata) GetMemoryUsage ¶
func (m *Metadata) GetMemoryUsage() *MemoryUsage
func (*Metadata) GetRuntime ¶
func (*Metadata) GetServices ¶
func (*Metadata) GetStarted ¶
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
func (*Metadata) XXX_DiscardUnknown ¶
func (m *Metadata) XXX_DiscardUnknown()
func (*Metadata) XXX_Marshal ¶
func (*Metadata) XXX_Unmarshal ¶
type NodeMeta ¶
type NodeMeta struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` Services []*NodeService `protobuf:"bytes,3,rep,name=Services,proto3" json:"Services,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NodeMeta) Descriptor ¶
func (*NodeMeta) GetServices ¶
func (m *NodeMeta) GetServices() []*NodeService
func (*NodeMeta) ProtoMessage ¶
func (*NodeMeta) ProtoMessage()
func (*NodeMeta) XXX_DiscardUnknown ¶
func (m *NodeMeta) XXX_DiscardUnknown()
func (*NodeMeta) XXX_Marshal ¶
func (*NodeMeta) XXX_Unmarshal ¶
type NodeService ¶
type NodeService struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` NetworkAddress string `protobuf:"bytes,2,opt,name=NetworkAddress,proto3" json:"NetworkAddress,omitempty"` Peer string `protobuf:"bytes,3,opt,name=Peer,proto3" json:"Peer,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NodeService) Descriptor ¶
func (*NodeService) Descriptor() ([]byte, []int)
func (*NodeService) GetID ¶
func (m *NodeService) GetID() string
func (*NodeService) GetNetworkAddress ¶
func (m *NodeService) GetNetworkAddress() string
func (*NodeService) GetPeer ¶
func (m *NodeService) GetPeer() string
func (*NodeService) ProtoMessage ¶
func (*NodeService) ProtoMessage()
func (*NodeService) Reset ¶
func (m *NodeService) Reset()
func (*NodeService) String ¶
func (m *NodeService) String() string
func (*NodeService) XXX_DiscardUnknown ¶
func (m *NodeService) XXX_DiscardUnknown()
func (*NodeService) XXX_Marshal ¶
func (m *NodeService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NodeService) XXX_Merge ¶
func (m *NodeService) XXX_Merge(src proto.Message)
func (*NodeService) XXX_Size ¶
func (m *NodeService) XXX_Size() int
func (*NodeService) XXX_Unmarshal ¶
func (m *NodeService) XXX_Unmarshal(b []byte) error
type Part ¶
type Part struct { Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Part) Descriptor ¶
func (*Part) ProtoMessage ¶
func (*Part) ProtoMessage()
func (*Part) XXX_DiscardUnknown ¶
func (m *Part) XXX_DiscardUnknown()
func (*Part) XXX_Unmarshal ¶
type PeerMetadataList ¶
type PeerMetadataList struct { Metadatas []*Metadata `protobuf:"bytes,1,rep,name=Metadatas,proto3" json:"Metadatas,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PeerMetadataList) Descriptor ¶
func (*PeerMetadataList) Descriptor() ([]byte, []int)
func (*PeerMetadataList) GetMetadatas ¶
func (m *PeerMetadataList) GetMetadatas() []*Metadata
func (*PeerMetadataList) ProtoMessage ¶
func (*PeerMetadataList) ProtoMessage()
func (*PeerMetadataList) Reset ¶
func (m *PeerMetadataList) Reset()
func (*PeerMetadataList) String ¶
func (m *PeerMetadataList) String() string
func (*PeerMetadataList) XXX_DiscardUnknown ¶
func (m *PeerMetadataList) XXX_DiscardUnknown()
func (*PeerMetadataList) XXX_Marshal ¶
func (m *PeerMetadataList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PeerMetadataList) XXX_Merge ¶
func (m *PeerMetadataList) XXX_Merge(src proto.Message)
func (*PeerMetadataList) XXX_Size ¶
func (m *PeerMetadataList) XXX_Size() int
func (*PeerMetadataList) XXX_Unmarshal ¶
func (m *PeerMetadataList) XXX_Unmarshal(b []byte) error
type PeerStore ¶
type PeerStore interface { ByID(id string) (Peer, error) ByService(name string) (SubscriptionSet, error) EndpointsByService(name string) ([]*NodeService, error) All() (SubscriptionSet, error) Exists(id string) bool Upsert(p Peer) error Delete(id string) error On(event string, handler func(Peer)) func() }
func NewPeerStore ¶
type ServiceConfig ¶
type ServiceLayer ¶
func NewServiceLayer ¶
func NewServiceLayer(name string, serviceConfig ServiceConfig, discovery Mesh) ServiceLayer
type SubscriptionSet ¶
type SubscriptionSet []Peer
func (SubscriptionSet) Apply ¶
func (set SubscriptionSet) Apply(f func(s Peer))
func (SubscriptionSet) ApplyIdx ¶
func (set SubscriptionSet) ApplyIdx(f func(idx int, s Peer))
func (SubscriptionSet) Filter ¶
func (set SubscriptionSet) Filter(filters ...peerFilter) SubscriptionSet
Source Files ¶
Click to show internal directories.
Click to hide internal directories.