report

package
v1.5.32 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 6 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

report

report library used by connectors to report key metrics

How it works :

connector should check if IsKeyCreated if key is not already created, connector should CreateCache.

Caching has 2 functionalities:

1- IsKeyCreated it takes objectID which check if the provided key is already cached, key is a full path for connectors it is report/processed/{connectorName}/{objectID}

2- CreateCache which store a cache record, it takes []map[string]interface each map contain 2 keys id and data.id is the objectID. data is the bytes of the actual object.

3- GetLastSync which get connector last sync date

4- SetLastSync which update connector last sync date

Documentation

Index

Constants

View Source
const (
	Path         = "report/new/%s"
	LastSyncFile = "0000-last-sync"
	Bucket       = "insights-v2-cache-%s"
	Region       = "us-east-2"
	FilesPath    = "report/new/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(environment string) *Manager

func (*Manager) Create

func (m *Manager) Create(endpoint string, data []map[string]interface{}) error

Create new cache record

func (*Manager) DeleteFile

func (m *Manager) DeleteFile(key string) error

GetAllFiles returns all files containing report data

func (*Manager) GetAllFiles

func (m *Manager) GetAllFiles() ([]string, error)

GetAllFiles returns all files containing report data

func (*Manager) GetFileByKey

func (m *Manager) GetFileByKey(endpoint string) ([]byte, error)

GetFileByKey get file by key

func (*Manager) GetLastSync

func (m *Manager) GetLastSync(endpoint string) (time.Time, error)

GetLastSync get connector sync date, if it is not exist return epoch date

func (*Manager) IsKeyCreated

func (m *Manager) IsKeyCreated(endpoint string, id string) (bool, error)

IsKeyCreated check if the key already exists

func (*Manager) SetLastSync

func (m *Manager) SetLastSync(endpoint string, lastSync time.Time) error

SetLastSync update connector last sync date

func (*Manager) UpdateFileByKey

func (m *Manager) UpdateFileByKey(endpoint string, data []byte) error

UpdateFileByKey get file by key

type S3Manager

type S3Manager interface {
	Save(payload []byte) error
	SaveWithKey(payload []byte, key string) error
	GetKeys() ([]string, error)
	Get(key string) ([]byte, error)
	Delete(key string) error
	GetFilesFromSubFolder(folder string) ([]string, error)
}

S3Manager used in connecting to s3

Jump to

Keyboard shortcuts

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