Documentation ¶
Index ¶
Constants ¶
View Source
const ( DB = "canopsis" ConfigurationMongoCollection = "configuration" SessionMongoCollection = "session" AlarmMongoCollection = "periodical_alarm" EntityMongoCollection = "default_entities" PbehaviorMongoCollection = "pbehavior" PbehaviorTypeMongoCollection = "pbehavior_type" PbehaviorReasonMongoCollection = "pbehavior_reason" PbehaviorExceptionMongoCollection = "pbehavior_exception" FileMongoCollection = "files" MetaAlarmRulesMongoCollection = "meta_alarm_rules" IdleRuleMongoCollection = "idle_rule" ExportTaskMongoCollection = "export_task" ActionLogMongoCollection = "action_log" DynamicInfosRulesMongoCollection = "dynamic_infos" EntityCategoryMongoCollection = "entity_category" ImportJobMongoCollection = "default_importgraph" JunitTestSuiteMongoCollection = "junit_test_suite" JunitTestCaseMediaMongoCollection = "junit_test_case_media" PlaylistMongoCollection = "view_playlist" StateSettingsMongoCollection = "state_settings" BroadcastMessageMongoCollection = "broadcast_message" AssociativeTableCollection = "default_associativetable" NotificationMongoCollection = "notification" ViewMongoCollection = "views" ViewTabMongoCollection = "viewtabs" WidgetMongoCollection = "widgets" WidgetFiltersMongoCollection = "widget_filters" WidgetTemplateMongoCollection = "widget_templates" ViewGroupMongoCollection = "viewgroups" // MessageRateStatsHourCollectionName contains old stats // deprecated MessageRateStatsHourCollectionName = "message_rate_statistic_hour" // Collection for ok/ko event statistics EventStatistics = "event_statistics" EventRecordsMongoCollection = "event_records" // Remediation collections InstructionMongoCollection = "instruction" InstructionExecutionMongoCollection = "instruction_execution" InstructionRatingMongoCollection = "instruction_rating" JobConfigMongoCollection = "job_config" JobMongoCollection = "job" JobHistoryMongoCollection = "job_history" // Data storage alarm collections ResolvedAlarmMongoCollection = "resolved_alarms" ArchivedAlarmMongoCollection = "archived_alarms" // Data storage entity collections ArchivedEntitiesMongoCollection = "archived_entities" TokenMongoCollection = "token" WebsocketConnectionMongoCollection = "websocket_connection" ResolveRuleMongoCollection = "resolve_rule" FlappingRuleMongoCollection = "flapping_rule" UserPreferencesMongoCollection = "userpreferences" KpiFilterMongoCollection = "kpi_filter" PatternMongoCollection = "pattern" EntityInfosDictionaryCollection = "entity_infos_dictionary" DynamicInfosDictionaryCollection = "dynamic_infos_dictionary" MapMongoCollection = "map" AlarmTagCollection = "alarm_tag" AlarmTagColorCollection = "alarm_tag_color" MibCollection = "default_mibs" SnmpRulesCollection = "default_snmprules" ScenarioMongoCollection = "action_scenario" DeclareTicketRuleMongoCollection = "declare_ticket_rule" WebhookHistoryMongoCollection = "webhook_history" LinkRuleMongoCollection = "link_rule" UserCollection = "user" RoleCollection = "role" RoleTemplateCollection = "role_template" PermissionCollection = "permission" EventFilterRuleCollection = "eventfilter" EventFilterFailureCollection = "eventfilter_failure" EntityCountersCollection = "entity_counters" MetaAlarmStatesCollection = "meta_alarm_states" ColorThemeCollection = "color_theme" EngineNotificationCollection = "engine_notification" IconCollection = "icon" )
View Source
const ( DefaultClientTimeout = 15 * time.Second DefaultServerSelectionTimeout = 30 * time.Second ChangeStreamTypeInsert = "insert" ChangeStreamTypeUpdate = "update" ChangeStreamTypeDelete = "delete" )
View Source
const ( SortAsc = "asc" SortDesc = "desc" )
View Source
const (
EnvURL = "CPS_MONGO_URL"
)
View Source
const MigrationHelperComment = `` /* 140-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChangeStream ¶
type CommandsRegister ¶
type CommandsRegister interface { Clear() RegisterInsert(i any) RegisterUpdate(id string, set bson.M) Commit(ctx context.Context) error }
func NewCommandsRegister ¶
func NewCommandsRegister(collection DbCollection, bulkSize int) CommandsRegister
type Cursor ¶
type DbClient ¶
type DbClient interface { Name() string Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (*mongo.ChangeStream, error) Collection(string) DbCollection CreateCollection(ctx context.Context, name string, opts ...*options.CreateCollectionOptions) error Disconnect(ctx context.Context) error SetRetry(count int, timeout time.Duration) Ping(ctx context.Context, rp *readpref.ReadPref) error WithTransaction(ctx context.Context, f func(context.Context) error) error ListCollectionNames(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions) ([]string, error) IsDistributed() bool RunCommand(ctx context.Context, runCommand any, opts ...*options.RunCmdOptions) SingleResultHelper RunAdminCommand(ctx context.Context, runCommand any, opts ...*options.RunCmdOptions) SingleResultHelper }
DbClient connected MongoDB client settings
type DbCollection ¶
type DbCollection interface { Name() string Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (Cursor, error) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (int64, error) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (int64, error) Distinct(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error) Drop(ctx context.Context) error Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (Cursor, error) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) SingleResultHelper FindOneAndDelete(ctx context.Context, filter interface{}, opts ...*options.FindOneAndDeleteOptions) SingleResultHelper FindOneAndReplace(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) SingleResultHelper FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) SingleResultHelper Indexes() mongo.IndexView InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (interface{}, error) InsertMany(ctx context.Context, documents []interface{}, opts ...*options.InsertManyOptions) ([]interface{}, error) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error) UpdateMany(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (ChangeStream, error) }
type ScriptExecutor ¶
ScriptExecutor is used to execute JavaScript migration scripts. Each implementation has to support global functions described above.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.