Documentation ¶
Index ¶
- func BestNode(id string, ordinal uint32, nodes map[uint32]struct{}) uint32
- func BestOf(id string, nodes map[uint32]struct{}) uint32
- func GRPCSettings() []grpc.ServerOption
- func GetLocationArray(id uint64, highestKnownOrdinal uint32) []uint32
- func GetLocationArrayString(id string, highestKnownOrdinal uint32) []uint32
- func MustParseOrdinal(ordinalStr string) uint32
- type Loader
- type ResourceType
- type Router
- func (router *Router) Locate(resourceType ResourceType, resourceId string) (interface{ ... }, *grpc.ClientConn, bool, error)
- func (router *Router) LocateWithLoadFunc(resourceType ResourceType, resourceId string, ...) (interface{ ... }, *grpc.ClientConn, bool, error)
- func (router *Router) Stop()
- func (router *Router) UnloadDevice(resourceType ResourceType, key string)
- func (router *Router) UnloadDeviceWithUnloadFunc(resourceType ResourceType, resourceId string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GRPCSettings ¶
func GRPCSettings() []grpc.ServerOption
func GetLocationArray ¶
returns a list of nodes from 0 to highestKnownOrdinal, randomly but deterministically sorted based on the id the list is stable even with changes to highestKnownOrdinal (in other words, changing highestKnownOrdinal will add/remove entries, but will never reorder them)
func GetLocationArrayString ¶
func MustParseOrdinal ¶
Types ¶
type Loader ¶
type Loader interface { Load(ctx context.Context, resourceType ResourceType, resourceId string) error Unload(resourceType ResourceType, resourceId string) }
type ResourceType ¶
type ResourceType uint32
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) Locate ¶
func (router *Router) Locate(resourceType ResourceType, resourceId string) (interface{ RUnlock() }, *grpc.ClientConn, bool, error)
Locate returns a processor for the given device, to either handle the request locally, or forward it on to the appropriate peer
func (*Router) LocateWithLoadFunc ¶
func (router *Router) LocateWithLoadFunc(resourceType ResourceType, resourceId string, loadFunc func(ctx context.Context, resourceType ResourceType, deviceId string) error) (interface{ RUnlock() }, *grpc.ClientConn, bool, error)
func (*Router) UnloadDevice ¶
func (router *Router) UnloadDevice(resourceType ResourceType, key string)
this should be called when a device has been, or should be, unloaded **from the local node only** due to external circumstance (device lock lost, device deleted, inactivity timeout, etc.)
func (*Router) UnloadDeviceWithUnloadFunc ¶
func (router *Router) UnloadDeviceWithUnloadFunc(resourceType ResourceType, resourceId string, unloadFunc func(resourceType ResourceType, resourceId string))
Source Files ¶
Click to show internal directories.
Click to hide internal directories.