uploader

package
v0.0.0-...-028f1de Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name represents name of this component that uploads data to OOS
	Name = "InventoryUploader"
)

Variables

This section is empty.

Functions

func Compress

func Compress(input string) (output string)

func PutInventory

func PutInventory(items string, resp *ApiResponse) error

Types

type ApiResponse

type ApiResponse struct {
	ErrCode string     `json:"errCode"`
	ErrMsg  string     `json:"errMsg"`
	Result  *OOSResult `json:"result"`
}

type Impl

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

func NewOptimizerImpl

func NewOptimizerImpl() (*Impl, error)

func NewOptimizerImplWithLocation

func NewOptimizerImplWithLocation(instanceId string, rootDir string, fileName string) (*Impl, error)

func (*Impl) GetContentHash

func (i *Impl) GetContentHash(inventoryItemName string) (hash string)

func (*Impl) UpdateContentHash

func (i *Impl) UpdateContentHash(inventoryItemName, hash string) (err error)

type InventoryUploader

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

InventoryUploader implements functionality to upload data to OOS Inventory.

func NewInventoryUploader

func NewInventoryUploader(instanceID string) (*InventoryUploader, error)

NewInventoryUploader creates a new InventoryUploader (which sends data to OOS Inventory)

func (*InventoryUploader) ConvertToOOSInventoryItems

func (u *InventoryUploader) ConvertToOOSInventoryItems(items []model.Item) (optimizedInventoryItems, nonOptimizedInventoryItems []*model.InventoryItem, err error)

ConvertToOOSInventoryItems converts given array of inventory.Item into an array of *model.InventoryItem. It returns 2 such arrays - one is optimized array which contains only contentHash for those inventory types where the dataset hasn't changed from previous collection. The other array is non-optimized array which contains both contentHash & content. This is done to avoid iterating over the inventory data twice. It throws error when it encounters error during conversion process.

func (InventoryUploader) GetDirtyOOSInventoryItems

func (u InventoryUploader) GetDirtyOOSInventoryItems(items []model.Item) (dirtyInventoryItems []*model.InventoryItem, err error)

GetDirtyOOSInventoryItems get the inventory item data for items that have changes since last successful report to OOS.

func (*InventoryUploader) SendDataToOOS

func (u *InventoryUploader) SendDataToOOS(instanceID string, items []*model.InventoryItem) (err error)

SendDataToOOS uploads given inventory items to OOS

type OOSCaller

type OOSCaller interface {
	PutInventory(input *model.PutInventoryInput) (err error)
}

type OOSCallerImpl

type OOSCallerImpl struct {
}

func NewOOSCallerImpl

func NewOOSCallerImpl() (*OOSCallerImpl, error)

func (*OOSCallerImpl) PutInventory

func (i *OOSCallerImpl) PutInventory(input *model.PutInventoryInput) (err error)

type OOSResult

type OOSResult struct {
	RequestId string
}

type Optimizer

type Optimizer interface {
	UpdateContentHash(inventoryItemName, hash string) (err error)
	GetContentHash(inventoryItemName string) (hash string)
}

Optimizer defines operations of content optimizer which inventory plugin makes use of

type T

type T interface {
	SendDataToOOS(items []*model.InventoryItem) (err error)
	ConvertToOOSInventoryItems(items []model.InventoryItem) (optimizedInventoryItems, nonOptimizedInventoryItems []*model.InventoryItem, err error)
	GetDirtyOOSInventoryItems(items []model.InventoryItem) (dirtyInventoryItems []*model.InventoryItem, err error)
}

Jump to

Keyboard shortcuts

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