host

package
v0.0.0-...-cb472e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(event reflector.Interface, rds *redis.Client) error

Attention, it can only be called for once.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(rds *redis.Client) *Client

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL