Documentation ¶
Index ¶
- func Module() fx.Option
- func RegisterEntitiesService(server *grpc.Server, cache *Entities, registry *rpc.HandlerRegistry) error
- type Entities
- func (e *Entities) Clear()
- func (e *Entities) GetByIP(entityIP string) (Entity, error)
- func (e *Entities) GetByName(entityName string) (Entity, error)
- func (e *Entities) GetEntities() *entitiesv1.Entities
- func (e *Entities) Put(entity Entity)
- func (e *Entities) PutForTest(entity *entitiesv1.Entity)
- func (e *Entities) Remove(entity Entity) bool
- type EntitiesService
- func (c *EntitiesService) GetEntities(ctx context.Context, _ *emptypb.Empty) (*entitiesv1.Entities, error)
- func (c *EntitiesService) GetEntityByIPAddress(ctx context.Context, req *entitiesv1.GetEntityByIPAddressRequest) (*entitiesv1.Entity, error)
- func (c *EntitiesService) GetEntityByName(ctx context.Context, req *entitiesv1.GetEntityByNameRequest) (*entitiesv1.Entity, error)
- func (c *EntitiesService) ListDiscoveryEntities(ctx context.Context, _ *cmdv1.ListDiscoveryEntitiesRequest) (*cmdv1.ListDiscoveryEntitiesAgentResponse, error)
- func (c *EntitiesService) ListDiscoveryEntity(ctx context.Context, req *cmdv1.ListDiscoveryEntityRequest) (*cmdv1.ListDiscoveryEntityAgentResponse, error)
- type Entity
- type EntityTrackers
- type FxIn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterEntitiesService ¶
func RegisterEntitiesService(server *grpc.Server, cache *Entities, registry *rpc.HandlerRegistry) error
RegisterEntitiesService registers a service for entity cache.
Types ¶
type Entities ¶
Entities maps IP addresses and Entity names to entities.
func (*Entities) GetEntities ¶
func (e *Entities) GetEntities() *entitiesv1.Entities
GetEntities returns *entitiesv1.EntitiyCache entities.
func (*Entities) PutForTest ¶ added in v2.6.0
func (e *Entities) PutForTest(entity *entitiesv1.Entity)
PutForTest maps given IP address and name to the entity it currently represents.
type EntitiesService ¶
type EntitiesService struct { entitiesv1.UnimplementedEntitiesServiceServer // contains filtered or unexported fields }
EntitiesService is the implementation of entitiesv1.EntitiesService interface.
func (*EntitiesService) GetEntities ¶
func (c *EntitiesService) GetEntities(ctx context.Context, _ *emptypb.Empty) (*entitiesv1.Entities, error)
GetEntities returns *entitiesv1.Entities which contains mappings of ip address to entity and entity name to entity.
func (*EntitiesService) GetEntityByIPAddress ¶
func (c *EntitiesService) GetEntityByIPAddress(ctx context.Context, req *entitiesv1.GetEntityByIPAddressRequest) (*entitiesv1.Entity, error)
GetEntityByIPAddress returns an entity by IP address.
func (*EntitiesService) GetEntityByName ¶
func (c *EntitiesService) GetEntityByName(ctx context.Context, req *entitiesv1.GetEntityByNameRequest) (*entitiesv1.Entity, error)
GetEntityByName returns an entity by name.
func (*EntitiesService) ListDiscoveryEntities ¶
func (c *EntitiesService) ListDiscoveryEntities(ctx context.Context, _ *cmdv1.ListDiscoveryEntitiesRequest) (*cmdv1.ListDiscoveryEntitiesAgentResponse, error)
ListDiscoveryEntities lists currently discovered entities by IP address.
func (*EntitiesService) ListDiscoveryEntity ¶
func (c *EntitiesService) ListDiscoveryEntity(ctx context.Context, req *cmdv1.ListDiscoveryEntityRequest) (*cmdv1.ListDiscoveryEntityAgentResponse, error)
ListDiscoveryEntity returns an entity by IP address or name.
type Entity ¶ added in v2.6.0
type Entity struct {
// contains filtered or unexported fields
}
Entity is an immutable wrapper over *entitiesv1.Entity.
func NewEntity ¶ added in v2.6.0
func NewEntity(entity *entitiesv1.Entity) Entity
NewEntity creates a new immutable entity from the copy of given entity.
func NewEntityFromImmutable ¶ added in v2.6.0
func NewEntityFromImmutable(entity *entitiesv1.Entity) Entity
NewEntityFromImmutable creates a new immutable entity, assuming given entity is immutable.
This allows avoiding a copy compared to NewEntity.
func (Entity) Clone ¶ added in v2.6.0
func (e Entity) Clone() *entitiesv1.Entity
Clone returns a mutable copy of the entity.
type EntityTrackers ¶
type EntityTrackers struct {
// contains filtered or unexported fields
}
EntityTrackers allows to register a service discovery for entity cache
Intended to be used during FX initialization.
func (*EntityTrackers) HasDiscovery ¶
func (et *EntityTrackers) HasDiscovery() bool
HasDiscovery returns whether RegisterServiceDiscovery was called before.
func (*EntityTrackers) RegisterServiceDiscovery ¶
func (et *EntityTrackers) RegisterServiceDiscovery(name string) notifiers.EventWriter
RegisterServiceDiscovery registers service discovery for entity cache and returns an EventWriter to push discovery events into.
Keys passed to EventWriter should not be prefixed.
Should be called at FX provide/invoke stage.
func (*EntityTrackers) Watcher ¶
func (et *EntityTrackers) Watcher() notifiers.Watcher
Watcher returns watcher that watches all events from registered service discoveries.