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
- type Manager
- func (m *Manager) Create(endpoint string, data []map[string]interface{}) error
- func (m *Manager) DeleteFile(key string) error
- func (m *Manager) GetAllFiles() ([]string, error)
- func (m *Manager) GetFileByKey(endpoint string) ([]byte, error)
- func (m *Manager) GetLastSync(endpoint string) (time.Time, error)
- func (m *Manager) IsKeyCreated(endpoint string, id string) (bool, error)
- func (m *Manager) SetLastSync(endpoint string, lastSync time.Time) error
- func (m *Manager) UpdateFileByKey(endpoint string, data []byte) error
- type S3Manager
Constants ¶
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 (*Manager) DeleteFile ¶
GetAllFiles returns all files containing report data
func (*Manager) GetAllFiles ¶
GetAllFiles returns all files containing report data
func (*Manager) GetFileByKey ¶
GetFileByKey get file by key
func (*Manager) GetLastSync ¶
GetLastSync get connector sync date, if it is not exist return epoch date
func (*Manager) IsKeyCreated ¶
IsKeyCreated check if the key already exists
func (*Manager) SetLastSync ¶
SetLastSync update connector last sync date