Documentation
¶
Overview ¶
Package state` provides interfaces for managing DataStore entities that correspond to device states
Index ¶
- Constants
- func BatchUpdateStates(ctx context.Context, states []*ufspb.StateRecord) ([]*ufspb.StateRecord, error)
- func DeleteDutStates(ctx context.Context, resourceNames []string) *ufsds.OpResults
- func DeleteStates(ctx context.Context, resourceNames []string) *ufsds.OpResults
- func GetAllDutStates(ctx context.Context) (*ufsds.OpResults, error)
- func GetAllStates(ctx context.Context) (*ufsds.OpResults, error)
- func GetDutState(ctx context.Context, id string) (*chromeosLab.DutState, error)
- func GetDutStateACL(ctx context.Context, id string) (*chromeosLab.DutState, error)
- func GetStateIndexedFieldName(input string) (string, error)
- func GetStateRecord(ctx context.Context, id string) (*ufspb.StateRecord, error)
- func ListDutStates(ctx context.Context, pageSize int32, pageToken string, ...) (res []*chromeosLab.DutState, nextPageToken string, err error)
- func ListDutStatesACL(ctx context.Context, pageSize int32, pageToken string, ...) (res []*chromeosLab.DutState, nextPageToken string, err error)
- func ListStateRecords(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.StateRecord, nextPageToken string, err error)
- func QueryDutStateByPropertyNames(ctx context.Context, propertyMap map[string]string, keysOnly bool) ([]*chromeosLab.DutState, error)
- func UpdateDutStates(ctx context.Context, dutStates []*chromeosLab.DutState) ([]*chromeosLab.DutState, error)
- func UpdateStateRecord(ctx context.Context, stateRecord *ufspb.StateRecord) (*ufspb.StateRecord, error)
- type DutStateEntity
- type RecordEntity
Constants ¶
const DutStateKind string = "DutState"
DutStateKind is the datastore entity kind of dut state.
Dut state is only specific to OS devices for now.
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 ¶
DeleteDutStates deletes a batch of dut states
func DeleteStates ¶
DeleteStates deletes a batch of states
func GetAllDutStates ¶
GetAllDutStates returns all dut states in datastore.
func GetAllStates ¶
GetAllStates returns all states in datastore.
func GetDutState ¶
GetDutState returns dut state for the given id from datastore.
func GetDutStateACL ¶
GetDutStateACL returns the DutState for the requested id if the user has permissions to do so.
func GetStateIndexedFieldName ¶
GetStateIndexedFieldName returns the index name
func GetStateRecord ¶
GetStateRecord returns the state for a given resource name.
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 ListDutStatesACL ¶
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 { Extra datastore.PropertyMap `gae:",extra"` // 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"` Realm string `gae:"realm"` // 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.
func (*DutStateEntity) GetRealm ¶
func (e *DutStateEntity) GetRealm() string
func (*DutStateEntity) Validate ¶
func (e *DutStateEntity) Validate() error
Validate returns whether a DutStateEntity is valid
type RecordEntity ¶
type RecordEntity struct { Extra datastore.PropertyMap `gae:",extra"` // 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.
func (*RecordEntity) Validate ¶
func (e *RecordEntity) Validate() error
Validate returns whether a RecordEntity is valid