Documentation ¶
Index ¶
Constants ¶
View Source
const ( StatusPending = "pending" StatusOngoing = "ongoing" StatusFailed = "failed" StatusDone = "done" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { ImportAll(c *gin.Context) ImportPartial(c *gin.Context) Status(c *gin.Context) }
func NewApi ¶
func NewApi( conf config.CanopsisConf, reporter StatusReporter, logger zerolog.Logger, ) API
type EventPublisher ¶
type ImportJob ¶
type ImportJob struct { ID string `bson:"_id" json:"_id"` Creation time.Time `bson:"creation" json:"creation"` LastPing *time.Time `bson:"last_ping,omitempty" json:"last_ping"` Status string `bson:"status" json:"status"` Info string `bson:"info,omitempty" json:"info"` ExecTime string `bson:"exec_time,omitempty" json:"exec_time"` Source string `bson:"source" json:"source"` Stats importcontextgraph.Stats `bson:"stats" json:"stats"` IsPartial bool `bson:"is_partial" json:"-"` }
type ImportWorker ¶
func NewImportWorker ¶
func NewImportWorker( conf config.CanopsisConf, publisher EventPublisher, reporter StatusReporter, importWorker importcontextgraph.Worker, logger zerolog.Logger, ) ImportWorker
type StatusReporter ¶
type StatusReporter interface { GetStatus(ctx context.Context, id string) (ImportJob, error) GetFirst(ctx context.Context, abandonedInterval time.Duration) (ImportJob, error) ReportCreate(ctx context.Context, job *ImportJob) error ReportOngoing(ctx context.Context, job ImportJob) error ReportDone(ctx context.Context, job ImportJob, stats importcontextgraph.Stats) (bool, error) ReportError(ctx context.Context, job ImportJob, execDuration time.Duration, err error) (bool, error) Clean(ctx context.Context, interval time.Duration) error }
func NewMongoStatusReporter ¶
func NewMongoStatusReporter(client libmongo.DbClient) StatusReporter
Click to show internal directories.
Click to hide internal directories.