Documentation ¶
Overview ¶
Package hostinfo provides support for Autotest's serialized hostinfo data.
Index ¶
- func Marshal(hi *HostInfo) ([]byte, error)
- func MarshalIndent(hi *HostInfo) ([]byte, error)
- func RevertDut(d *inventory.DeviceUnderTest, hi *HostInfo)
- type AdminClient
- type Getter
- func (g *Getter) GetContentsForHostname(ctx context.Context, hostname string) (string, error)
- func (g *Getter) GetStableVersionForHostname(ctx context.Context, hostname string) (map[string]string, error)
- func (g *Getter) GetStableVersionForModel(ctx context.Context, board, model string) (map[string]string, error)
- type HostInfo
- type InventoryClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalIndent ¶
MarshalIndent serializes the HostInfo struct into a slice of bytes. The prefix and indent options of json.MarshalIndent are not exposed to the user because You Don't Need Them.
func RevertDut ¶
func RevertDut(d *inventory.DeviceUnderTest, hi *HostInfo)
RevertDut reverts the Autotest hostinfo back to an inventory DUT struct.
Types ¶
type AdminClient ¶
type AdminClient interface {
GetStableVersion(ctx context.Context, in *fleet.GetStableVersionRequest, opts ...grpc.CallOption) (*fleet.GetStableVersionResponse, error)
}
AdminClient is a client that knows how to respond to the GetStableVersion RPC call. Its prototypical implementation is fleet.InventoryClient.
type Getter ¶
type Getter struct {
// contains filtered or unexported fields
}
Getter is a container for the clients needed to construct the host_info_store contents for a given hostname.
func NewGetter ¶
func NewGetter( ic InventoryClient, ac AdminClient, ) *Getter
NewGetter constructs a getter in the default configuration.
func (*Getter) GetContentsForHostname ¶
GetContentsForHostname gets the entire hostinfostore file contents for a given hostname as a string.
type HostInfo ¶
type HostInfo struct { Labels []string `json:"labels"` Attributes map[string]string `json:"attributes"` StableVersions map[string]string `json:"stable_versions"` }
HostInfo stores the host information. Hostinfo files are used to pass host information to Autotest and receive host information changes from Autotest.
func ConvertDut ¶
func ConvertDut(d *inventory.DeviceUnderTest) *HostInfo
ConvertDut converts the inventory DUT struct to Autotest hostinfo.
type InventoryClient ¶
type InventoryClient interface {
GetDutInfo(ctx context.Context, id string, byHostname bool) (*inventory.DeviceUnderTest, error)
}
InventoryClient is a client that knows how to resolve a DUT hostname to information about the DUT. Its prototypical implementation is inventoryclient.InventoryClientV2.