state

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DutStateKind string = "DutState"

DutStateKind is the datastore entity kind of dut state.

Dut state is only specific to OS devices for now.

View Source
const RecordKind string = "State"

RecordKind is the datastore entity kind of state.

Variables

This section is empty.

Functions

func BatchUpdateStates

func BatchUpdateStates(ctx context.Context, states []*ufspb.StateRecord) ([]*ufspb.StateRecord, error)

BatchUpdateStates updates the states to UFS.

This can be used inside a transaction

func DeleteDutStates

func DeleteDutStates(ctx context.Context, resourceNames []string) *ufsds.OpResults

DeleteDutStates deletes a batch of dut states

func DeleteStates

func DeleteStates(ctx context.Context, resourceNames []string) *ufsds.OpResults

DeleteStates deletes a batch of states

func GetAllDutStates

func GetAllDutStates(ctx context.Context) (*ufsds.OpResults, error)

GetAllDutStates returns all dut states in datastore.

func GetAllStates

func GetAllStates(ctx context.Context) (*ufsds.OpResults, error)

GetAllStates returns all states in datastore.

func GetDutState

func GetDutState(ctx context.Context, id string) (*chromeosLab.DutState, error)

GetDutState returns dut state for the given id from datastore.

func GetStateIndexedFieldName

func GetStateIndexedFieldName(input string) (string, error)

GetStateIndexedFieldName returns the index name

func GetStateRecord

func GetStateRecord(ctx context.Context, id string) (*ufspb.StateRecord, error)

GetStateRecord returns the state for a given resource name.

func ImportDutStates

func ImportDutStates(ctx context.Context, dutStates []*chromeosLab.DutState) (*ufsds.OpResults, error)

ImportDutStates creates or updates a batch of dut states in datastore

func ImportStateRecords

func ImportStateRecords(ctx context.Context, states []*ufspb.StateRecord) (*ufsds.OpResults, error)

ImportStateRecords creates or updates a batch of state records in datastore

func ListAllDutStates

func ListAllDutStates(ctx context.Context, keysOnly bool) (res []*chromeosLab.DutState, err error)

ListAllDutStates returns all DutState in datastore.

func ListDutStates

func ListDutStates(ctx context.Context, pageSize int32, pageToken string, filterMap map[string][]interface{}, keysOnly bool) (res []*chromeosLab.DutState, nextPageToken string, err error)

ListDutStates lists the DutStates.

Does a query over DutState entities. Returns up to pageSize entities, plus non-nil cursor (if there are more results). pageSize must be positive.

func ListStateRecords

func ListStateRecords(ctx context.Context, pageSize int32, pageToken string, filterMap map[string][]interface{}) (res []*ufspb.StateRecord, nextPageToken string, err error)

ListStateRecords lists all the states

func QueryDutStateByPropertyNames

func QueryDutStateByPropertyNames(ctx context.Context, propertyMap map[string]string, keysOnly bool) ([]*chromeosLab.DutState, error)

QueryDutStateByPropertyNames queries DutState Entity in the datastore. If keysOnly is true, then only key field is populated in returned DutStates.

func UpdateDutStates

func UpdateDutStates(ctx context.Context, dutStates []*chromeosLab.DutState) ([]*chromeosLab.DutState, error)

UpdateDutStates updates dut states in datastore.

func UpdateStateRecord

func UpdateStateRecord(ctx context.Context, stateRecord *ufspb.StateRecord) (*ufspb.StateRecord, error)

UpdateStateRecord updates a state record in datastore.

Types

type DutStateEntity

type DutStateEntity struct {

	// refer to the device id
	ID       string `gae:"$id"`
	Hostname string `gae:"hostname"`
	// lab.DutState cannot be directly used as it contains pointer (timestamp).
	DutState []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

DutStateEntity is a datastore entity that tracks dut state.

func (*DutStateEntity) GetProto

func (e *DutStateEntity) GetProto() (proto.Message, error)

GetProto returns the unmarshaled dut state.

type RecordEntity

type RecordEntity struct {

	// refer to the hostname
	ResourceName string `gae:"$id"`
	ResourceType string `gae:"resource_type"`
	State        string `gae:"state"`
	// ufspb.StateRecord cannot be directly used as it contains pointer (timestamp).
	StateRecord []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

RecordEntity is a datastore entity that tracks dhcp.

func (*RecordEntity) GetProto

func (e *RecordEntity) GetProto() (proto.Message, error)

GetProto returns the unmarshaled DHCP.

Jump to

Keyboard shortcuts

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