Documentation ¶
Index ¶
- func NewCache(event reflector.Interface, rds *redis.Client) error
- type Client
- func (c *Client) GetHostWithID(ctx context.Context, opt *metadata.SearchHostWithIDOption) (string, error)
- func (c *Client) GetHostWithInnerIP(ctx context.Context, opt *metadata.SearchHostWithInnerIPOption) (string, error)
- func (c *Client) ListHostWithHostIDs(ctx context.Context, opt *metadata.ListWithIDOption) ([]string, error)
- func (c *Client) ListHostsWithPage(ctx context.Context, opt *metadata.ListHostWithPage) (int64, []string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetHostWithID ¶
func (c *Client) GetHostWithID(ctx context.Context, opt *metadata.SearchHostWithIDOption) (string, error)
GetHostWithID get host with host id. fields allows you can specify which fields you need only.
func (*Client) GetHostWithInnerIP ¶
func (c *Client) GetHostWithInnerIP(ctx context.Context, opt *metadata.SearchHostWithInnerIPOption) (string, error)
GetHostWithInnerIP is to get host with the ip and cloud id it belongs. the ip must be a unique one, can not be a ip string with multiple ip separated with comma.
func (*Client) ListHostWithHostIDs ¶
func (c *Client) ListHostWithHostIDs(ctx context.Context, opt *metadata.ListWithIDOption) ([]string, error)
ListHostWithHostIDs list hosts info from redis with host id list. if a host is not exist in cache and still can not find in mongodb, then it will not be return. so the returned array may not equal to the request host ids length and the sequence is also may not same.
func (*Client) ListHostsWithPage ¶
func (c *Client) ListHostsWithPage(ctx context.Context, opt *metadata.ListHostWithPage) (int64, []string, error)
ListHostIDsWithPage get host id list sorted with host id with forward sort. this id list has a ttl life cycle, and triggered with update with user's request.