stores

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

View Source
const (
	TopicsCollection             string = "topics"
	SubscriptionsCollection      string = "subscriptions"
	DailyTopicMsgCountCollection string = "daily_topic_msg_count"
	UsersCollection              string = "users"
	ProjectsCollection           string = "projects"
	UserRegistrationsCollection  string = "user_registrations"
	SchemasCollection            string = "schemas"
	OpMetricsCollection          string = "op_metrics"
	RolesCollection              string = "roles"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DocNotFound

type DocNotFound struct{}

func (DocNotFound) Error

func (DocNotFound) Error() string

type MockStore

type MockStore struct {
	Server             string
	Database           string
	UserRegistrations  []QUserRegistration
	SubList            []QSub
	TopicList          []QTopic
	DailyTopicMsgCount []QDailyTopicMsgCount
	ProjectList        []QProject
	UserList           []QUser
	RoleList           []QRole
	SchemaList         []QSchema
	Session            bool
	TopicsACL          map[string]QAcl
	SubsACL            map[string]QAcl
	OpMetrics          map[string]QopMetric
}

MockStore holds configuration

func NewMockStore

func NewMockStore(server string, database string) *MockStore

NewMockStore creates new mock store

func (*MockStore) AppendToACL

func (mk *MockStore) AppendToACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error

AppendToACL adds given users to an existing ACL

func (*MockStore) AppendToUserProjects

func (mk *MockStore) AppendToUserProjects(ctx context.Context, userUUID string, projectUUID string, pRoles ...string) error

AppendToUserProjects adds project and specific roles to a users role list

func (*MockStore) Clone

func (mk *MockStore) Clone() Store

Clone the store

func (*MockStore) Close

func (mk *MockStore) Close()

Close is used to close session

func (*MockStore) DeleteRegistration

func (mk *MockStore) DeleteRegistration(ctx context.Context, regUUID string) error

func (*MockStore) DeleteSchema

func (mk *MockStore) DeleteSchema(ctx context.Context, schemaUUID string) error

func (*MockStore) ExistsInACL

func (mk *MockStore) ExistsInACL(ctx context.Context, projectUUID string, resource string, resourceName string, userUUID string) error

ExistsInACL checks if a users exists in an ACL resource (topic or subscription)

func (*MockStore) GetAllRoles

func (mk *MockStore) GetAllRoles(ctx context.Context) []string

GetAllRoles returns a list of all available roles

func (*MockStore) GetOpMetrics

func (mk *MockStore) GetOpMetrics(ctx context.Context) []QopMetric

GetOpMetrics returns operation metrics

func (*MockStore) GetUserFromToken

func (mk *MockStore) GetUserFromToken(ctx context.Context, token string) (QUser, error)

GetUserFromToken retrieves specific user info from a given token

func (*MockStore) GetUserRoles

func (mk *MockStore) GetUserRoles(ctx context.Context, projectUUID string, token string) ([]string, string)

GetUserRoles returns the roles of a user in a project

func (*MockStore) HasProject

func (mk *MockStore) HasProject(ctx context.Context, name string) bool

HasProject returns true if project exists in store

func (*MockStore) HasResourceRoles

func (mk *MockStore) HasResourceRoles(ctx context.Context, resource string, roles []string) bool

HasResourceRoles returns the roles of a user in a project

func (*MockStore) HasUsers

func (mk *MockStore) HasUsers(ctx context.Context, projectUUID string, users []string) (bool, []string)

HasUsers accepts a user array of usernames and returns the not found

func (*MockStore) IncrementDailyTopicMsgCount

func (mk *MockStore) IncrementDailyTopicMsgCount(ctx context.Context, projectUUID string, topicName string, num int64, date time.Time) error

IncrementDailyTopicMsgCount increase number of messages published in a topic

func (*MockStore) IncrementSubBytes

func (mk *MockStore) IncrementSubBytes(ctx context.Context, projectUUID string, name string, totalBytes int64) error

IncrementSubBytes increases the total number of bytes published in a subscription

func (*MockStore) IncrementSubMsgNum

func (mk *MockStore) IncrementSubMsgNum(ctx context.Context, projectUUID string, name string, num int64) error

IncrementSubMsgNum increase number of messages pulled in a subscription

func (*MockStore) IncrementTopicBytes

func (mk *MockStore) IncrementTopicBytes(ctx context.Context, projectUUID string, name string, totalBytes int64) error

IncrementTopicBytes increases the total number of bytes published in a topic

func (*MockStore) IncrementTopicMsgNum

func (mk *MockStore) IncrementTopicMsgNum(ctx context.Context, projectUUID string, name string, num int64) error

IncrementTopicMsgNum increase number of messages published in a topic

func (*MockStore) Initialize

func (mk *MockStore) Initialize()

Initialize is used to initialize the mock

func (*MockStore) InsertOpMetric

func (mk *MockStore) InsertOpMetric(ctx context.Context, hostname string, cpu float64, mem float64) error

InsertOpMetric inserts a new operation metric

func (*MockStore) InsertProject

func (mk *MockStore) InsertProject(ctx context.Context, uuid string, name string, createdOn time.Time, modifiedOn time.Time, createdBy string, description string) error

InsertProject inserts a project to the store

func (*MockStore) InsertResourceRoles

func (mk *MockStore) InsertResourceRoles(ctx context.Context, resource string, roles []string) error

func (*MockStore) InsertSchema

func (mk *MockStore) InsertSchema(ctx context.Context, projectUUID, schemaUUID, name, schemaType, rawSchemaString string) error

func (*MockStore) InsertSub

func (mk *MockStore) InsertSub(ctx context.Context, projectUUID string, name string, topic string,
	offset int64, ack int, pushCfg QPushConfig, createdOn time.Time) error

InsertSub inserts a new sub object to the store

func (*MockStore) InsertTopic

func (mk *MockStore) InsertTopic(ctx context.Context, projectUUID string, name string, schemaUUID string, createdOn time.Time) error

InsertTopic inserts a new topic object to the store

func (*MockStore) InsertUser

func (mk *MockStore) InsertUser(ctx context.Context, uuid string, projects []QProjectRoles, name string, fname string, lname string, org string, desc string, token string, email string, serviceRoles []string, createdOn time.Time, modifiedOn time.Time, createdBy string) error

InsertUser inserts a new user to the store

func (*MockStore) LinkTopicSchema

func (mk *MockStore) LinkTopicSchema(ctx context.Context, projectUUID, name, schemaUUID string) error

func (*MockStore) ModACL

func (mk *MockStore) ModACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error

ModACL changes the acl in a function

func (*MockStore) ModAck

func (mk *MockStore) ModAck(ctx context.Context, projectUUID string, name string, ack int) error

ModAck modifies the subscription ack

func (*MockStore) ModSubPush

func (mk *MockStore) ModSubPush(ctx context.Context, projectUUID string, name string, config QPushConfig) error

ModSubPush modifies the subscription push configuration

func (*MockStore) PaginatedQueryUsers

func (mk *MockStore) PaginatedQueryUsers(ctx context.Context, pageToken string, pageSize int64, projectUUID string) ([]QUser, int64, string, error)

PaginatedQueryUsers provides query to the list of users using pagination parameters

func (*MockStore) QueryACL

func (mk *MockStore) QueryACL(ctx context.Context, projectUUID string, resource string, name string) (QAcl, error)

QueryACL Topic/Subscription ACL

func (*MockStore) QueryDailyProjectMsgCount

func (mk *MockStore) QueryDailyProjectMsgCount(ctx context.Context, projectUUID string) ([]QDailyProjectMsgCount, error)

QueryDailyProjectMsgCount retrieves the number of total messages that have been published to all project's topics daily

func (*MockStore) QueryDailyTopicMsgCount

func (mk *MockStore) QueryDailyTopicMsgCount(ctx context.Context, projectUUID string, topicName string, date time.Time) ([]QDailyTopicMsgCount, error)

QueryDailyTopicMsgCount returns results regarding the number of messages published to a topic

func (*MockStore) QueryOneSub

func (mk *MockStore) QueryOneSub(ctx context.Context, projectUUID string, name string) (QSub, error)

QueryOneSub returns one sub exactly

func (*MockStore) QueryProjects

func (mk *MockStore) QueryProjects(ctx context.Context, uuid string, name string) ([]QProject, error)

QueryProjects function queries for a specific project or for a list of all projects

func (*MockStore) QueryPushSubs

func (mk *MockStore) QueryPushSubs(ctx context.Context) []QSub

QueryPushSubs Query push Subscription info from store

func (*MockStore) QueryRegistrations

func (mk *MockStore) QueryRegistrations(ctx context.Context, regUUID, status, activationToken, name, email, org string) ([]QUserRegistration, error)

func (*MockStore) QuerySchemas

func (mk *MockStore) QuerySchemas(ctx context.Context, projectUUID, schemaUUID, name string) ([]QSchema, error)

func (*MockStore) QuerySubs

func (mk *MockStore) QuerySubs(ctx context.Context, projectUUID, userUUID, name, pageToken string, pageSize int64) ([]QSub, int64, string, error)

QuerySubs Query Subscription info from store

func (*MockStore) QuerySubsByACL

func (mk *MockStore) QuerySubsByACL(ctx context.Context, projectUUID, user string) ([]QSub, error)

QuerySubsByACL returns subscriptions that contain a specific user in their ACL

func (*MockStore) QuerySubsByTopic

func (mk *MockStore) QuerySubsByTopic(ctx context.Context, projectUUID, topic string) ([]QSub, error)

QuerySubsByTopic returns subscriptions attached to a given topic

func (*MockStore) QueryTopics

func (mk *MockStore) QueryTopics(ctx context.Context, projectUUID, userUUID, name, pageToken string, pageSize int64) ([]QTopic, int64, string, error)

QueryTopics Query Subscription info from store

func (*MockStore) QueryTopicsByACL

func (mk *MockStore) QueryTopicsByACL(ctx context.Context, projectUUID, user string) ([]QTopic, error)

QueryTopicsByACL returns topics that contain a specific user in their ACL

func (*MockStore) QueryTotalMessagesPerProject

func (mk *MockStore) QueryTotalMessagesPerProject(ctx context.Context, projectUUIDs []string, startDate time.Time, endDate time.Time) ([]QProjectMessageCount, error)

func (*MockStore) QueryUsers

func (mk *MockStore) QueryUsers(ctx context.Context, projectUUID string, uuid string, name string) ([]QUser, error)

QueryUsers queries the datastore for user information

func (*MockStore) RegisterUser

func (mk *MockStore) RegisterUser(ctx context.Context, uuid, name, firstName, lastName, email, org, desc, registeredAt, atkn, status string) error

func (*MockStore) RemoveFromACL

func (mk *MockStore) RemoveFromACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error

RemoveFromACL removes given users from an existing acl

func (*MockStore) RemoveProject

func (mk *MockStore) RemoveProject(ctx context.Context, uuid string) error

RemoveProject removes an existing project

func (*MockStore) RemoveProjectDailyMessageCounters

func (mk *MockStore) RemoveProjectDailyMessageCounters(ctx context.Context, projectUUID string) error

RemoveProjectDailyMessageCounters removes all existing message counters belonging to a specific project uuid

func (*MockStore) RemoveProjectSubs

func (mk *MockStore) RemoveProjectSubs(ctx context.Context, projectUUID string) error

RemoveProjectSubs removes all existing subs belonging to a specific project uuid

func (*MockStore) RemoveProjectTopics

func (mk *MockStore) RemoveProjectTopics(ctx context.Context, projectUUID string) error

RemoveProjectTopics removes all topics belonging to a specific project uuid

func (*MockStore) RemoveSub

func (mk *MockStore) RemoveSub(ctx context.Context, projectUUID string, name string) error

RemoveSub removes an existing sub from the store

func (*MockStore) RemoveTopic

func (mk *MockStore) RemoveTopic(ctx context.Context, projectUUID string, name string) error

RemoveTopic removes an existing topic

func (*MockStore) RemoveUser

func (mk *MockStore) RemoveUser(ctx context.Context, uuid string) error

RemoveUser removes an existing user

func (*MockStore) SubscriptionsCount

func (mk *MockStore) SubscriptionsCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)

func (*MockStore) TopicsCount

func (mk *MockStore) TopicsCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)

func (*MockStore) UpdateProject

func (mk *MockStore) UpdateProject(ctx context.Context, projectUUID string, name string, description string, modifiedOn time.Time) error

UpdateProject updates project information

func (*MockStore) UpdateRegistration

func (mk *MockStore) UpdateRegistration(ctx context.Context, regUUID, status, declineComment, modifiedBy, modifiedAt string) error

func (*MockStore) UpdateSchema

func (mk *MockStore) UpdateSchema(ctx context.Context, schemaUUID, name, schemaType, rawSchemaString string) error

func (*MockStore) UpdateSubConsumeRate

func (mk *MockStore) UpdateSubConsumeRate(ctx context.Context, projectUUID string, name string, rate float64) error

UpdateSubConsumeRate updates the subscription's consume rate

func (*MockStore) UpdateSubLatestConsume

func (mk *MockStore) UpdateSubLatestConsume(ctx context.Context, projectUUID string, name string, date time.Time) error

UpdateSubLatestConsume updates the subscription's latest consume time

func (*MockStore) UpdateSubOffset

func (mk *MockStore) UpdateSubOffset(ctx context.Context, projectUUID string, name string, offset int64)

UpdateSubOffset updates the offset of the current subscription

func (*MockStore) UpdateSubOffsetAck

func (mk *MockStore) UpdateSubOffsetAck(ctx context.Context, projectUUID string, name string, offset int64, ts string) error

UpdateSubOffsetAck updates the offset of the current subscription

func (*MockStore) UpdateSubPull

func (mk *MockStore) UpdateSubPull(ctx context.Context, projectUUID string, name string, offset int64, ts string) error

UpdateSubPull updates next offset info after a pull

func (*MockStore) UpdateTopicLatestPublish

func (mk *MockStore) UpdateTopicLatestPublish(ctx context.Context, projectUUID string, name string, date time.Time) error

UpdateTopicLatestPublish updates the topic's latest publish time

func (*MockStore) UpdateTopicPublishRate

func (mk *MockStore) UpdateTopicPublishRate(ctx context.Context, projectUUID string, name string, rate float64) error

UpdateTopicPublishRate updates the topic's publishing rate

func (*MockStore) UpdateUser

func (mk *MockStore) UpdateUser(ctx context.Context, uuid, fname, lname, org, desc string, projects []QProjectRoles, name string, email string, serviceRoles []string, modifiedOn time.Time) error

UpdateUser updates user information

func (*MockStore) UpdateUserToken

func (mk *MockStore) UpdateUserToken(ctx context.Context, uuid string, token string) error

UpdateUserToken updates user's token

func (*MockStore) UsersCount

func (mk *MockStore) UsersCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)

type MongoStoreWithOfficialDriver

type MongoStoreWithOfficialDriver struct {
	Server   string
	Database string
	// contains filtered or unexported fields
}

func NewMongoStoreWithOfficialDriver

func NewMongoStoreWithOfficialDriver(server, database string) *MongoStoreWithOfficialDriver

func (*MongoStoreWithOfficialDriver) AppendToACL

func (store *MongoStoreWithOfficialDriver) AppendToACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error

AppendToACL adds additional users to an existing ACL

func (*MongoStoreWithOfficialDriver) AppendToUserProjects

func (store *MongoStoreWithOfficialDriver) AppendToUserProjects(ctx context.Context, userUUID string, projectUUID string, pRoles ...string) error

AppendToUserProjects appends a new unique project to the user's projects

func (*MongoStoreWithOfficialDriver) Clone

func (store *MongoStoreWithOfficialDriver) Clone() Store

func (*MongoStoreWithOfficialDriver) Close

func (store *MongoStoreWithOfficialDriver) Close()

func (*MongoStoreWithOfficialDriver) DeleteRegistration

func (store *MongoStoreWithOfficialDriver) DeleteRegistration(ctx context.Context, uuid string) error

DeleteRegistration removes the respective registration from the

func (*MongoStoreWithOfficialDriver) DeleteSchema

func (store *MongoStoreWithOfficialDriver) DeleteSchema(ctx context.Context, schemaUUID string) error

DeleteSchema removes the schema from the store It also clears all the respective topics from the schema_uuid of the deleted schema

func (*MongoStoreWithOfficialDriver) ExistsInACL

func (store *MongoStoreWithOfficialDriver) ExistsInACL(ctx context.Context, projectUUID string, resource string, resourceName string, userUUID string) error

ExistsInACL checks if a user is part of a topic's or sub's acl

func (*MongoStoreWithOfficialDriver) GetAllRoles

func (store *MongoStoreWithOfficialDriver) GetAllRoles(ctx context.Context) []string

GetAllRoles returns a list of all available roles

func (*MongoStoreWithOfficialDriver) GetOpMetrics

func (store *MongoStoreWithOfficialDriver) GetOpMetrics(ctx context.Context) []QopMetric

GetOpMetrics returns the operational metrics from datastore

func (*MongoStoreWithOfficialDriver) GetUserFromToken

func (store *MongoStoreWithOfficialDriver) GetUserFromToken(ctx context.Context, token string) (QUser, error)

GetUserFromToken returns user information from a specific token

func (*MongoStoreWithOfficialDriver) GetUserRoles

func (store *MongoStoreWithOfficialDriver) GetUserRoles(ctx context.Context, projectUUID string, token string) ([]string, string)

func (*MongoStoreWithOfficialDriver) HasProject

func (store *MongoStoreWithOfficialDriver) HasProject(ctx context.Context, name string) bool

func (*MongoStoreWithOfficialDriver) HasResourceRoles

func (store *MongoStoreWithOfficialDriver) HasResourceRoles(ctx context.Context, resource string, roles []string) bool

func (*MongoStoreWithOfficialDriver) HasUsers

func (store *MongoStoreWithOfficialDriver) HasUsers(ctx context.Context, projectUUID string, users []string) (bool, []string)

HasUsers accepts a user array of usernames and returns the not found

func (*MongoStoreWithOfficialDriver) IncrementDailyTopicMsgCount

func (store *MongoStoreWithOfficialDriver) IncrementDailyTopicMsgCount(ctx context.Context, projectUUID string,
	topicName string, num int64, date time.Time) error

IncrementDailyTopicMsgCount increments the daily count of published messages to a specific topic

func (*MongoStoreWithOfficialDriver) IncrementSubBytes

func (store *MongoStoreWithOfficialDriver) IncrementSubBytes(ctx context.Context, projectUUID string, name string, totalBytes int64) error

IncrementSubBytes increases the total number of bytes consumed from a subscription

func (*MongoStoreWithOfficialDriver) IncrementSubMsgNum

func (store *MongoStoreWithOfficialDriver) IncrementSubMsgNum(ctx context.Context, projectUUID string, name string, num int64) error

IncrementSubMsgNum increments the number of messages pulled in a subscription

func (*MongoStoreWithOfficialDriver) IncrementTopicBytes

func (store *MongoStoreWithOfficialDriver) IncrementTopicBytes(ctx context.Context, projectUUID string,
	name string, totalBytes int64) error

IncrementTopicBytes increases the total number of bytes published in a topic

func (*MongoStoreWithOfficialDriver) IncrementTopicMsgNum

func (store *MongoStoreWithOfficialDriver) IncrementTopicMsgNum(ctx context.Context, projectUUID string,
	name string, num int64) error

IncrementTopicMsgNum increments the number of messages published in a topic

func (*MongoStoreWithOfficialDriver) Initialize

func (store *MongoStoreWithOfficialDriver) Initialize()

func (*MongoStoreWithOfficialDriver) InsertOpMetric

func (store *MongoStoreWithOfficialDriver) InsertOpMetric(ctx context.Context, hostname string, cpu float64, mem float64) error

InsertOpMetric inserts an operational metric

func (*MongoStoreWithOfficialDriver) InsertProject

func (store *MongoStoreWithOfficialDriver) InsertProject(ctx context.Context, uuid string, name string,
	createdOn time.Time, modifiedOn time.Time, createdBy string, description string) error

func (*MongoStoreWithOfficialDriver) InsertResourceRoles

func (store *MongoStoreWithOfficialDriver) InsertResourceRoles(ctx context.Context, resource string, roles []string) error

func (*MongoStoreWithOfficialDriver) InsertSchema

func (store *MongoStoreWithOfficialDriver) InsertSchema(ctx context.Context, projectUUID, schemaUUID, name,
	schemaType, rawSchemaString string) error

func (*MongoStoreWithOfficialDriver) InsertSub

func (store *MongoStoreWithOfficialDriver) InsertSub(ctx context.Context, projectUUID string, name string, topic string,
	offset int64, ack int, pushCfg QPushConfig, createdOn time.Time) error

func (*MongoStoreWithOfficialDriver) InsertTopic

func (store *MongoStoreWithOfficialDriver) InsertTopic(ctx context.Context, projectUUID string, name string, schemaUUID string, createdOn time.Time) error

func (*MongoStoreWithOfficialDriver) InsertUser

func (store *MongoStoreWithOfficialDriver) InsertUser(ctx context.Context, uuid string, projects []QProjectRoles,
	name string, firstName string, lastName string, org string, desc string, token string, email string, serviceRoles []string, createdOn time.Time, modifiedOn time.Time, createdBy string) error

InsertUser inserts a new user to the store

func (*MongoStoreWithOfficialDriver) LinkTopicSchema

func (store *MongoStoreWithOfficialDriver) LinkTopicSchema(ctx context.Context, projectUUID, name, schemaUUID string) error

func (*MongoStoreWithOfficialDriver) ModACL

func (store *MongoStoreWithOfficialDriver) ModACL(ctx context.Context, projectUUID string,
	resource string, name string, acl []string) error

ModACL modifies the push configuration

func (*MongoStoreWithOfficialDriver) ModAck

func (store *MongoStoreWithOfficialDriver) ModAck(ctx context.Context, projectUUID string, name string, ack int) error

ModAck modifies the subscription's ack timeout field in mongodb

func (*MongoStoreWithOfficialDriver) ModSubPush

func (store *MongoStoreWithOfficialDriver) ModSubPush(ctx context.Context, projectUUID string,
	name string, pushCfg QPushConfig) error

ModSubPush modifies the push configuration

func (*MongoStoreWithOfficialDriver) PaginatedQueryUsers

func (store *MongoStoreWithOfficialDriver) PaginatedQueryUsers(ctx context.Context, pageToken string, pageSize int64,
	projectUUID string) ([]QUser, int64, string, error)

PaginatedQueryUsers returns a page of users

func (*MongoStoreWithOfficialDriver) QueryACL

func (store *MongoStoreWithOfficialDriver) QueryACL(ctx context.Context, projectUUID string, resource string, name string) (QAcl, error)

QueryACL queries topic or subscription for a list of authorized users

func (*MongoStoreWithOfficialDriver) QueryDailyProjectMsgCount

func (store *MongoStoreWithOfficialDriver) QueryDailyProjectMsgCount(ctx context.Context, projectUUID string) ([]QDailyProjectMsgCount, error)

QueryDailyProjectMsgCount queries the total messages per day for a given project

func (*MongoStoreWithOfficialDriver) QueryDailyTopicMsgCount

func (store *MongoStoreWithOfficialDriver) QueryDailyTopicMsgCount(ctx context.Context, projectUUID string, topicName string, date time.Time) ([]QDailyTopicMsgCount, error)

QueryDailyTopicMsgCount returns results regarding the number of messages published to a topic

func (*MongoStoreWithOfficialDriver) QueryOneSub

func (store *MongoStoreWithOfficialDriver) QueryOneSub(ctx context.Context, projectUUID string, name string) (QSub, error)

QueryOneSub queries and returns specific sub of project

func (*MongoStoreWithOfficialDriver) QueryProjects

func (store *MongoStoreWithOfficialDriver) QueryProjects(ctx context.Context, uuid string, name string) ([]QProject, error)

QueryProjects queries the database for a specific project or a list of all projects

func (*MongoStoreWithOfficialDriver) QueryPushSubs

func (store *MongoStoreWithOfficialDriver) QueryPushSubs(ctx context.Context) []QSub

QueryPushSubs retrieves subscriptions that have a push_endpoint defined

func (*MongoStoreWithOfficialDriver) QueryRegistrations

func (store *MongoStoreWithOfficialDriver) QueryRegistrations(ctx context.Context, regUUID, status, activationToken, name, email, org string) ([]QUserRegistration, error)

func (*MongoStoreWithOfficialDriver) QuerySchemas

func (store *MongoStoreWithOfficialDriver) QuerySchemas(ctx context.Context, projectUUID, schemaUUID, name string) ([]QSchema, error)

func (*MongoStoreWithOfficialDriver) QuerySubs

func (store *MongoStoreWithOfficialDriver) QuerySubs(ctx context.Context, projectUUID string, userUUID string, name string, pageToken string, pageSize int64) ([]QSub, int64, string, error)

QuerySubs Query Subscription info from store

func (*MongoStoreWithOfficialDriver) QuerySubsByACL

func (store *MongoStoreWithOfficialDriver) QuerySubsByACL(ctx context.Context, projectUUID, user string) ([]QSub, error)

QuerySubsByACL returns subscriptions that a specific username has access to

func (*MongoStoreWithOfficialDriver) QuerySubsByTopic

func (store *MongoStoreWithOfficialDriver) QuerySubsByTopic(ctx context.Context, projectUUID, topic string) ([]QSub, error)

QuerySubsByTopic returns subscriptions of a specific topic

func (*MongoStoreWithOfficialDriver) QueryTopics

func (store *MongoStoreWithOfficialDriver) QueryTopics(ctx context.Context, projectUUID string, userUUID string, name string, pageToken string, pageSize int64) ([]QTopic, int64, string, error)

func (*MongoStoreWithOfficialDriver) QueryTopicsByACL

func (store *MongoStoreWithOfficialDriver) QueryTopicsByACL(ctx context.Context, projectUUID, user string) ([]QTopic, error)

QueryTopicsByACL returns topics that a specific username has access to

func (*MongoStoreWithOfficialDriver) QueryTotalMessagesPerProject

func (store *MongoStoreWithOfficialDriver) QueryTotalMessagesPerProject(ctx context.Context, projectUUIDs []string, startDate time.Time, endDate time.Time) ([]QProjectMessageCount, error)

func (*MongoStoreWithOfficialDriver) QueryUsers

func (store *MongoStoreWithOfficialDriver) QueryUsers(ctx context.Context, projectUUID string,
	uuid string, name string) ([]QUser, error)

QueryUsers queries user(s) information belonging to a project

func (*MongoStoreWithOfficialDriver) RegisterUser

func (store *MongoStoreWithOfficialDriver) RegisterUser(ctx context.Context, uuid, name, firstName, lastName, email,
	org, desc, registeredAt, atkn, status string) error

RegisterUser inserts a new user registration to the database

func (*MongoStoreWithOfficialDriver) RemoveFromACL

func (store *MongoStoreWithOfficialDriver) RemoveFromACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error

RemoveFromACL removes users for a given ACL

func (*MongoStoreWithOfficialDriver) RemoveProject

func (store *MongoStoreWithOfficialDriver) RemoveProject(ctx context.Context, uuid string) error

RemoveProject removes a project from the store

func (*MongoStoreWithOfficialDriver) RemoveProjectDailyMessageCounters

func (store *MongoStoreWithOfficialDriver) RemoveProjectDailyMessageCounters(ctx context.Context, projectUUID string) error

RemoveProjectDailyMessageCounters removes all message counts related to a project UUID

func (*MongoStoreWithOfficialDriver) RemoveProjectSubs

func (store *MongoStoreWithOfficialDriver) RemoveProjectSubs(ctx context.Context, projectUUID string) error

RemoveProjectSubs removes all subscriptions related to a project UUID

func (*MongoStoreWithOfficialDriver) RemoveProjectTopics

func (store *MongoStoreWithOfficialDriver) RemoveProjectTopics(ctx context.Context, projectUUID string) error

RemoveProjectTopics removes all topics related to a project UUID

func (*MongoStoreWithOfficialDriver) RemoveSub

func (store *MongoStoreWithOfficialDriver) RemoveSub(ctx context.Context, projectUUID string, name string) error

RemoveSub removes a subscription from the store

func (*MongoStoreWithOfficialDriver) RemoveTopic

func (store *MongoStoreWithOfficialDriver) RemoveTopic(ctx context.Context, projectUUID string, name string) error

func (*MongoStoreWithOfficialDriver) RemoveUser

func (store *MongoStoreWithOfficialDriver) RemoveUser(ctx context.Context, uuid string) error

func (*MongoStoreWithOfficialDriver) SubscriptionsCount

func (store *MongoStoreWithOfficialDriver) SubscriptionsCount(ctx context.Context, startDate, endDate time.Time,
	projectUUIDs []string) (map[string]int64, error)

SubscriptionsCount returns the amount of subscriptions created in the given time period per project

func (*MongoStoreWithOfficialDriver) TopicsCount

func (store *MongoStoreWithOfficialDriver) TopicsCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)

TopicsCount returns the amount of topics created in the given time period per project

func (*MongoStoreWithOfficialDriver) UpdateProject

func (store *MongoStoreWithOfficialDriver) UpdateProject(ctx context.Context, projectUUID string, name string,
	description string, modifiedOn time.Time) error

UpdateProject updates project information

func (*MongoStoreWithOfficialDriver) UpdateRegistration

func (store *MongoStoreWithOfficialDriver) UpdateRegistration(ctx context.Context, regUUID, status, declineComment, modifiedBy, modifiedAt string) error

func (*MongoStoreWithOfficialDriver) UpdateSchema

func (store *MongoStoreWithOfficialDriver) UpdateSchema(ctx context.Context, schemaUUID, name, schemaType, rawSchemaString string) error

func (*MongoStoreWithOfficialDriver) UpdateSubConsumeRate

func (store *MongoStoreWithOfficialDriver) UpdateSubConsumeRate(ctx context.Context, projectUUID string, name string, rate float64) error

UpdateSubConsumeRate updates the subscription's consume rate

func (*MongoStoreWithOfficialDriver) UpdateSubLatestConsume

func (store *MongoStoreWithOfficialDriver) UpdateSubLatestConsume(ctx context.Context, projectUUID string, name string, date time.Time) error

UpdateSubLatestConsume updates the subscription's latest consume time

func (*MongoStoreWithOfficialDriver) UpdateSubOffset

func (store *MongoStoreWithOfficialDriver) UpdateSubOffset(ctx context.Context, projectUUID string, name string, offset int64)

UpdateSubOffset updates a subscription offset

func (*MongoStoreWithOfficialDriver) UpdateSubOffsetAck

func (store *MongoStoreWithOfficialDriver) UpdateSubOffsetAck(ctx context.Context, projectUUID string, name string,
	offset int64, ts string) error

func (*MongoStoreWithOfficialDriver) UpdateSubPull

func (store *MongoStoreWithOfficialDriver) UpdateSubPull(ctx context.Context, projectUUID string, name string,
	nextOff int64, ts string) error

func (*MongoStoreWithOfficialDriver) UpdateTopicLatestPublish

func (store *MongoStoreWithOfficialDriver) UpdateTopicLatestPublish(ctx context.Context, projectUUID string, name string, date time.Time) error

func (*MongoStoreWithOfficialDriver) UpdateTopicPublishRate

func (store *MongoStoreWithOfficialDriver) UpdateTopicPublishRate(ctx context.Context, projectUUID string, name string, rate float64) error

func (*MongoStoreWithOfficialDriver) UpdateUser

func (store *MongoStoreWithOfficialDriver) UpdateUser(ctx context.Context, uuid, fname, lname, org,
	desc string, projects []QProjectRoles, name string, email string, serviceRoles []string, modifiedOn time.Time) error

UpdateUser updates user information

func (*MongoStoreWithOfficialDriver) UpdateUserToken

func (store *MongoStoreWithOfficialDriver) UpdateUserToken(ctx context.Context, uuid string, token string) error

UpdateUserToken updates user's token

func (*MongoStoreWithOfficialDriver) UsersCount

func (store *MongoStoreWithOfficialDriver) UsersCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)

UsersCount returns the amount of users created in the given time period per project

type QAcl

type QAcl struct {
	ACL []string `bson:"acl"`
}

QAcl holds a list of authorized users queried from topic or subscription collections

type QDailyProjectMsgCount

type QDailyProjectMsgCount struct {
	Date             time.Time `bson:"date"`
	NumberOfMessages int64     `bson:"msg_count"`
}

QDailyProjectMsgCount holds information about the total amount of messages published to all of a project's topics daily

type QDailyTopicMsgCount

type QDailyTopicMsgCount struct {
	Date             time.Time `bson:"date"`
	ProjectUUID      string    `bson:"project_uuid"`
	TopicName        string    `bson:"topic_name"`
	NumberOfMessages int64     `bson:"msg_count"`
}

QDailyTopicMsgCount holds information about the daily number of messages published to a topic

type QProject

type QProject struct {
	UUID        string    `bson:"uuid"`
	Name        string    `bson:"name"`
	CreatedOn   time.Time `bson:"created_on"`
	ModifiedOn  time.Time `bson:"modified_on"`
	CreatedBy   string    `bson:"created_by"`
	Description string    `bson:"description"`
}

QProject are the results of the QProject query

type QProjectMessageCount

type QProjectMessageCount struct {
	ProjectUUID          string  `bson:"project_uuid"`
	NumberOfMessages     int64   `bson:"msg_count"`
	AverageDailyMessages float64 `bson:"avg_daily_msg"`
}

QProjectMessageCount holds information about the total messages and average daily messages for a specific project

type QProjectResourceCount

type QProjectResourceCount struct {
	ProjectUUID string `bson:"project_uuid"`
	Count       int64  `bson:"resource_count"`
}

type QProjectRoles

type QProjectRoles struct {
	ProjectUUID string   `bson:"project_uuid"`
	Roles       []string `bson:"roles"`
}

QProjectRoles include information about projects and roles that user has

type QPushConfig

type QPushConfig struct {
	Type                string `bson:"type"`
	PushEndpoint        string `bson:"push_endpoint"`
	MaxMessages         int64  `bson:"max_messages"`
	AuthorizationType   string `bson:"authorization_type"`
	AuthorizationHeader string `bson:"authorization_header"`
	RetPolicy           string `bson:"retry_policy"`
	RetPeriod           int    `bson:"retry_period"`
	VerificationHash    string `bson:"verification_hash"`
	Verified            bool   `bson:"verified"`
	MattermostURL       string `bson:"mattermost_url"`
	MattermostUsername  string `bson:"mattermost_username"`
	MattermostChannel   string `bson:"mattermost_channel"`
	Base64Decode        bool   `bson:"base_64_decode"`
}

QPushConfig holds optional configuration for push operations

type QRole

type QRole struct {
	Name  string   `bson:"resource"`
	Roles []string `bson:"roles"`
}

QRole holds roles resources relationships

type QSchema

type QSchema struct {
	ProjectUUID string `bson:"project_uuid"`
	UUID        string `bson:"uuid"`
	Name        string `bson:"name"`
	Type        string `bson:"type"`
	RawSchema   string `bson:"raw_schema"`
}

QSchema is the query model representing a schema

type QSub

type QSub struct {
	ID                  interface{} `bson:"_id,omitempty"`
	ProjectUUID         string      `bson:"project_uuid"`
	Name                string      `bson:"name"`
	Topic               string      `bson:"topic"`
	Offset              int64       `bson:"offset"`
	NextOffset          int64       `bson:"next_offset"`
	PendingAck          string      `bson:"pending_ack"`
	PushType            string      `bson:"push_type"`
	PushEndpoint        string      `bson:"push_endpoint"`
	MaxMessages         int64       `bson:"max_messages"`
	AuthorizationType   string      `bson:"authorization_type"`
	AuthorizationHeader string      `bson:"authorization_header"`
	Ack                 int         `bson:"ack"`
	RetPolicy           string      `bson:"retry_policy"`
	RetPeriod           int         `bson:"retry_period"`
	MsgNum              int64       `bson:"msg_num"`
	TotalBytes          int64       `bson:"total_bytes"`
	VerificationHash    string      `bson:"verification_hash"`
	Verified            bool        `bson:"verified"`
	MattermostURL       string      `bson:"mattermost_url"`
	MattermostUsername  string      `bson:"mattermost_username"`
	MattermostChannel   string      `bson:"mattermost_channel"`
	Base64Decode        bool        `bson:"base_64_decode"`
	LatestConsume       time.Time   `bson:"latest_consume"`
	ConsumeRate         float64     `bson:"consume_rate"`
	CreatedOn           time.Time   `bson:"created_on"`
	ACL                 []string    `bson:"acl"`
}

QSub are the results of the Qsub query

type QTopic

type QTopic struct {
	ID            interface{} `bson:"_id,omitempty"`
	ProjectUUID   string      `bson:"project_uuid"`
	Name          string      `bson:"name"`
	MsgNum        int64       `bson:"msg_num"`
	TotalBytes    int64       `bson:"total_bytes"`
	LatestPublish time.Time   `bson:"latest_publish"`
	PublishRate   float64     `bson:"publish_rate"`
	SchemaUUID    string      `bson:"schema_uuid"`
	CreatedOn     time.Time   `bson:"created_on"`
	ACL           []string    `bson:"acl"`
}

QTopic are the results of the QTopic query

type QUser

type QUser struct {
	ID           interface{}     `bson:"_id,omitempty"`
	UUID         string          `bson:"uuid"`
	Projects     []QProjectRoles `bson:"projects"`
	Name         string          `bson:"name"`
	FirstName    string          `bson:"first_name,omitempty"`
	LastName     string          `bson:"last_name,omitempty"`
	Organization string          `bson:"organization,omitempty"`
	Description  string          `bson:"description,omitempty"`
	Token        string          `bson:"token"`
	Email        string          `bson:"email"`
	ServiceRoles []string        `bson:"service_roles"`
	CreatedOn    time.Time       `bson:"created_on"`
	ModifiedOn   time.Time       `bson:"modified_on"`
	CreatedBy    string          `bson:"created_by"`
}

QUser are the results of the QUser query

type QUserRegistration

type QUserRegistration struct {
	UUID            string `bson:"uuid"`
	Name            string `bson:"name"`
	FirstName       string `bson:"first_name"`
	LastName        string `bson:"last_name"`
	Organization    string `bson:"organization"`
	Description     string `bson:"description"`
	Email           string `bson:"email"`
	ActivationToken string `bson:"activation_token"`
	Status          string `bson:"status"`
	DeclineComment  string `bson:"decline_comment"`
	RegisteredAt    string `bson:"registered_at"`
	ModifiedBy      string `bson:"modified_by"`
	ModifiedAt      string `bson:"modified_at"`
}

QUserRegistration holds information about a UserRegister query

type QopMetric

type QopMetric struct {
	Hostname string  `bson:"hostname"`
	CPU      float64 `bson:"cpu"`
	MEM      float64 `bson:"mem"`
}

QopMetric are the results of the QopMetric query

type Store

type Store interface {
	Initialize()
	Clone() Store
	Close()

	LinkTopicSchema(ctx context.Context, projectUUID, name, schemaUUID string) error
	QueryTopicsByACL(ctx context.Context, projectUUID, user string) ([]QTopic, error)
	QueryTopics(ctx context.Context, projectUUID string, userUUID string, name string, pageToken string, pageSize int64) ([]QTopic, int64, string, error)
	UpdateTopicLatestPublish(ctx context.Context, projectUUID string, name string, date time.Time) error
	UpdateTopicPublishRate(ctx context.Context, projectUUID string, name string, rate float64) error
	RemoveTopic(ctx context.Context, projectUUID string, name string) error
	InsertTopic(ctx context.Context, projectUUID string, name string, schemaUUID string, createdOn time.Time) error
	TopicsCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)
	QueryDailyTopicMsgCount(ctx context.Context, projectUUID string, name string, date time.Time) ([]QDailyTopicMsgCount, error)
	IncrementTopicMsgNum(ctx context.Context, projectUUID string, name string, num int64) error
	IncrementDailyTopicMsgCount(ctx context.Context, projectUUID string, topicName string, num int64, date time.Time) error
	IncrementTopicBytes(ctx context.Context, projectUUID string, name string, totalBytes int64) error

	QuerySubsByTopic(ctx context.Context, projectUUID, topic string) ([]QSub, error)
	QuerySubsByACL(ctx context.Context, projectUUID, user string) ([]QSub, error)
	QuerySubs(ctx context.Context, projectUUID string, userUUID string, name string, pageToken string, pageSize int64) ([]QSub, int64, string, error)
	UpdateSubLatestConsume(ctx context.Context, projectUUID string, name string, date time.Time) error
	UpdateSubConsumeRate(ctx context.Context, projectUUID string, name string, rate float64) error
	RemoveSub(ctx context.Context, projectUUID string, name string) error
	IncrementSubBytes(ctx context.Context, projectUUID string, name string, totalBytes int64) error
	IncrementSubMsgNum(ctx context.Context, projectUUID string, name string, num int64) error
	InsertSub(ctx context.Context, projectUUID string, name string, topic string, offest int64, ack int, pushCfg QPushConfig, createdOn time.Time) error
	QueryOneSub(ctx context.Context, projectUUID string, name string) (QSub, error)
	QueryPushSubs(ctx context.Context) []QSub
	SubscriptionsCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)
	ModAck(ctx context.Context, projectUUID string, name string, ack int) error
	UpdateSubOffset(ctx context.Context, projectUUID string, name string, offset int64)
	UpdateSubPull(ctx context.Context, projectUUID string, name string, offset int64, ts string) error
	UpdateSubOffsetAck(ctx context.Context, projectUUID string, name string, offset int64, ts string) error
	ModSubPush(ctx context.Context, projectUUID string, name string, pushCfg QPushConfig) error

	HasUsers(ctx context.Context, projectUUID string, users []string) (bool, []string)
	PaginatedQueryUsers(ctx context.Context, pageToken string, pageSize int64, projectUUID string) ([]QUser, int64, string, error)
	QueryUsers(ctx context.Context, projectUUID string, uuid string, name string) ([]QUser, error)
	UpdateUser(ctx context.Context, uuid, fname, lname, org, desc string, projects []QProjectRoles, name string, email string, serviceRoles []string, modifiedOn time.Time) error
	AppendToUserProjects(ctx context.Context, userUUID string, projectUUID string, pRoles ...string) error
	UpdateUserToken(ctx context.Context, uuid string, token string) error
	RemoveUser(ctx context.Context, uuid string) error
	InsertUser(ctx context.Context, uuid string, projects []QProjectRoles, name string, firstName string, lastName string, org string, desc string, token string, email string, serviceRoles []string, createdOn time.Time, modifiedOn time.Time, createdBy string) error
	GetUserFromToken(ctx context.Context, token string) (QUser, error)
	UsersCount(ctx context.Context, startDate, endDate time.Time, projectUUIDs []string) (map[string]int64, error)
	GetUserRoles(ctx context.Context, projectUUID string, token string) ([]string, string)

	QueryProjects(ctx context.Context, uuid string, name string) ([]QProject, error)
	UpdateProject(ctx context.Context, projectUUID string, name string, description string, modifiedOn time.Time) error
	RemoveProject(ctx context.Context, uuid string) error
	RemoveProjectTopics(ctx context.Context, projectUUID string) error
	RemoveProjectSubs(ctx context.Context, projectUUID string) error
	RemoveProjectDailyMessageCounters(ctx context.Context, projectUUID string) error
	QueryDailyProjectMsgCount(ctx context.Context, projectUUID string) ([]QDailyProjectMsgCount, error)
	QueryTotalMessagesPerProject(ctx context.Context, projectUUIDs []string, startDate time.Time, endDate time.Time) ([]QProjectMessageCount, error)
	InsertProject(ctx context.Context, uuid string, name string, createdOn time.Time, modifiedOn time.Time, createdBy string, description string) error
	HasProject(ctx context.Context, name string) bool

	RegisterUser(ctx context.Context, uuid, name, firstName, lastName, email, org, desc, registeredAt, atkn, status string) error
	DeleteRegistration(ctx context.Context, uuid string) error
	QueryRegistrations(ctx context.Context, regUUID, status, activationToken, name, email, org string) ([]QUserRegistration, error)
	UpdateRegistration(ctx context.Context, regUUID, status, declineComment, modifiedBy, modifiedAt string) error

	InsertSchema(ctx context.Context, projectUUID, schemaUUID, name, schemaType, rawSchemaString string) error
	QuerySchemas(ctx context.Context, projectUUID, schemaUUID, name string) ([]QSchema, error)
	UpdateSchema(ctx context.Context, schemaUUID, name, schemaType, rawSchemaString string) error
	DeleteSchema(ctx context.Context, schemaUUID string) error

	// ##### ACL QUERIES ######
	QueryACL(ctx context.Context, projectUUID string, resource string, name string) (QAcl, error)
	ExistsInACL(ctx context.Context, projectUUID string, resource string, resourceName string, userUUID string) error
	ModACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error
	AppendToACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error
	RemoveFromACL(ctx context.Context, projectUUID string, resource string, name string, acl []string) error

	// ##### ROLES QUERIES #####
	HasResourceRoles(ctx context.Context, resource string, roles []string) bool
	InsertResourceRoles(ctx context.Context, resource string, roles []string) error
	GetAllRoles(ctx context.Context) []string

	// ##### OP METRICS QUERIES #####
	InsertOpMetric(ctx context.Context, hostname string, cpu float64, mem float64) error
	GetOpMetrics(ctx context.Context) []QopMetric
}

Store encapsulates the generic store interface

Jump to

Keyboard shortcuts

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