cfg2datastore

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

This section is empty.

Variables

This section is empty.

Functions

func DownloadCfgProto

func DownloadCfgProto(ctx context.Context, client gitiles.GitilesClient, project, committish, path string, msg proto.Message) error

DownloadCfgProto downloads the config data in proto.Message.

func GetCachedCfgByIds

func GetCachedCfgByIds(ctx context.Context, entities []EntityInterface) ([]proto.Message, error)

GetCachedCfgByIds gets the cached config from datastore by Ids.

func NewGitilesClient

func NewGitilesClient(ctx context.Context, host string) (gitiles.GitilesClient, error)

NewGitilesClient returns a gitiles client to access the device config data.

func SyncProtoToDatastore

func SyncProtoToDatastore(ctx context.Context, cfgs []proto.Message, entityBuider func(proto.Message) (EntityInterface, error)) error

SyncProtoToDatastore save the input proto messages to datastore as proper entities.

Types

type EntityInterface

type EntityInterface interface {
	SetUpdatedTime(time.Time)
	GetMessagePayload() (proto.Message, error)
	GetID() string
}

EntityInterface is the interface that entities can sync with cfg file in git repo.

Jump to

Keyboard shortcuts

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