meta_storage

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package meta_storage interacts with core database schema and stores cloudquery metadata such as fetch summaries

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Logger hclog.Logger
	// contains filtered or unexported fields
}

func NewClient

func NewClient(db execution.QueryExecer, logger hclog.Logger) *Client

func (*Client) GetFetchSummaryForProvider

func (c *Client) GetFetchSummaryForProvider(ctx context.Context, provider string) (*FetchSummary, error)

GetFetchSummaryForProvider gets latest fetch summary for specific provider

func (*Client) MigrateCore

func (c *Client) MigrateCore(ctx context.Context, de database.DialectExecutor) error

func (*Client) SaveFetchSummary

func (c *Client) SaveFetchSummary(ctx context.Context, fs *FetchSummary) error

SaveFetchSummary saves fetch summary into fetches database

type FetchSummary

type FetchSummary struct {
	CqId uuid.UUID `db:"id"`
	//  Unique Id of fetch session
	FetchId            uuid.UUID              `db:"fetch_id"`
	CreatedAt          *time.Time             `db:"created_at"`
	Start              *time.Time             `db:"start"`
	Finish             *time.Time             `db:"finish"`
	IsSuccess          bool                   `db:"is_success"`
	TotalResourceCount uint64                 `db:"total_resource_count"`
	TotalErrorsCount   uint64                 `db:"total_errors_count"`
	ProviderName       string                 `db:"provider_name"`
	ProviderAlias      string                 `db:"provider_alias"`
	ProviderVersion    string                 `db:"provider_version"`
	CoreVersion        string                 `db:"core_version"`
	Resources          ResourceFetchSummaries `db:"results"`
}

FetchSummary includes a summarized report of fetch, such as fetch id, fetch start and finish, resources fetch results

type ResourceFetchSummaries

type ResourceFetchSummaries []ResourceFetchSummary

func (ResourceFetchSummaries) Value

Value implements Valuer interface required by goqu

type ResourceFetchSummary

type ResourceFetchSummary struct {
	ResourceName string `json:"resource_name"`
	// map of resources that have finished fetching
	FinishedResources map[string]bool `json:"finished_resources"`
	// Error value if any, if returned the stream will be canceled
	Error string `json:"error"`
	// Execution status of resource
	Status string `json:"status"`
	// Total Amount of resources collected by this resource
	ResourceCount uint64 `json:"resource_count"`
}

ResourceFetchSummary includes a data about fetching specific resource

Jump to

Keyboard shortcuts

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