Documentation ¶
Index ¶
- func Module() fx.Option
- func RegisterEntityCacheService(server *grpc.Server, cache *EntityCache)
- type EntityCache
- func (c *EntityCache) Clear()
- func (c *EntityCache) GetByIP(entityIP string) (*entitycachev1.Entity, error)
- func (c *EntityCache) GetByName(entityName string) (*entitycachev1.Entity, error)
- func (c *EntityCache) GetEntities() *entitycachev1.EntityCache
- func (c *EntityCache) Put(entity *entitycachev1.Entity)
- func (c *EntityCache) Remove(entity *entitycachev1.Entity) bool
- type EntityCacheService
- func (c *EntityCacheService) GetEntityByIPAddress(ctx context.Context, req *entitycachev1.GetEntityByIPAddressRequest) (*entitycachev1.Entity, error)
- func (c *EntityCacheService) GetEntityByName(ctx context.Context, req *entitycachev1.GetEntityByNameRequest) (*entitycachev1.Entity, error)
- func (c *EntityCacheService) GetEntityCache(ctx context.Context, _ *emptypb.Empty) (*entitycachev1.EntityCache, error)
- type FxIn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterEntityCacheService ¶ added in v0.1.2
func RegisterEntityCacheService(server *grpc.Server, cache *EntityCache)
RegisterEntityCacheService registers a service for entity cache.
Types ¶
type EntityCache ¶
EntityCache maps IP addresses and Entity names to entities.
func NewEntityCache ¶
func NewEntityCache() *EntityCache
NewEntityCache creates a new, empty EntityCache.
func (*EntityCache) Clear ¶
func (c *EntityCache) Clear()
Clear removes all entities from the cache.
func (*EntityCache) GetByIP ¶
func (c *EntityCache) GetByIP(entityIP string) (*entitycachev1.Entity, error)
GetByIP retrieves entity with a given IP address.
func (*EntityCache) GetByName ¶
func (c *EntityCache) GetByName(entityName string) (*entitycachev1.Entity, error)
GetByName retrieves entity with a given name.
func (*EntityCache) GetEntities ¶ added in v0.2.1
func (c *EntityCache) GetEntities() *entitycachev1.EntityCache
GetEntities returns *entitycachev1.EntitiyCache entities.
func (*EntityCache) Put ¶
func (c *EntityCache) Put(entity *entitycachev1.Entity)
Put maps given IP address and name to the entity it currently represents.
func (*EntityCache) Remove ¶
func (c *EntityCache) Remove(entity *entitycachev1.Entity) bool
Remove removes entity from the cache and returns `true` if any of IP address or name mapping exists. If no such entity was found, returns `false`.
type EntityCacheService ¶ added in v0.2.1
type EntityCacheService struct { entitycachev1.UnimplementedEntityCacheServiceServer // contains filtered or unexported fields }
EntityCacheService is the implementation of entitycachev1.EntityCacheService interface.
func (*EntityCacheService) GetEntityByIPAddress ¶ added in v0.2.1
func (c *EntityCacheService) GetEntityByIPAddress(ctx context.Context, req *entitycachev1.GetEntityByIPAddressRequest) (*entitycachev1.Entity, error)
GetEntityByIPAddress returns an entity by IP address.
func (*EntityCacheService) GetEntityByName ¶ added in v0.2.1
func (c *EntityCacheService) GetEntityByName(ctx context.Context, req *entitycachev1.GetEntityByNameRequest) (*entitycachev1.Entity, error)
GetEntityByName returns an entity by name.
func (*EntityCacheService) GetEntityCache ¶ added in v0.2.1
func (c *EntityCacheService) GetEntityCache(ctx context.Context, _ *emptypb.Empty) (*entitycachev1.EntityCache, error)
GetEntityCache returns *entitycachev1.EntityCache which contains mappings of ip address to entity and entity name to entity.