stores

package
v1.0.6-1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStore

type MockStore struct {
	Server             string
	Database           string
	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(projectUUID string, resource string, name string, acl []string) error

AppendToACL adds given users to an existing ACL

func (*MockStore) AppendToUserProjects

func (mk *MockStore) AppendToUserProjects(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) DeleteSchema

func (mk *MockStore) DeleteSchema(schemaUUID string) error

func (*MockStore) ExistsInACL

func (mk *MockStore) ExistsInACL(projectUUID string, resource string, resourceName string, userUUID string) error

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

func (*MockStore) GetAllRoles

func (mk *MockStore) GetAllRoles() []string

GetAllRoles returns a list of all available roles

func (*MockStore) GetOpMetrics

func (mk *MockStore) GetOpMetrics() []QopMetric

GetOpMetrics returns operation metrics

func (*MockStore) GetUserFromToken

func (mk *MockStore) GetUserFromToken(token string) (QUser, error)

GetUserFromToken retrieves specific user info from a given token

func (*MockStore) GetUserRoles

func (mk *MockStore) GetUserRoles(projectUUID string, token string) ([]string, string)

GetUserRoles returns the roles of a user in a project

func (*MockStore) HasProject

func (mk *MockStore) HasProject(name string) bool

HasProject returns true if project exists in store

func (*MockStore) HasResourceRoles

func (mk *MockStore) HasResourceRoles(resource string, roles []string) bool

HasResourceRoles returns the roles of a user in a project

func (*MockStore) HasUsers

func (mk *MockStore) HasUsers(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(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(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(projectUUID string, name string, num int64) error

IncrementSubMsgNum increase number of messages pulled in a subscription

func (*MockStore) IncrementTopicBytes

func (mk *MockStore) IncrementTopicBytes(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(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(hostname string, cpu float64, mem float64) error

InsertOpMetric inserts a new operation metric

func (*MockStore) InsertProject

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

InsertProject inserts a project to the store

func (*MockStore) InsertSchema

func (mk *MockStore) InsertSchema(projectUUID, schemaUUID, name, schemaType, rawSchemaString string) error

func (*MockStore) InsertSub

func (mk *MockStore) InsertSub(projectUUID string, name string, topic string, offset int64, maxMessages int64, ack int, push string, rPolicy string, rPeriod int, vhash string, verified bool) error

InsertSub inserts a new sub object to the store

func (*MockStore) InsertTopic

func (mk *MockStore) InsertTopic(projectUUID string, name string, schemaUUID string) error

InsertTopic inserts a new topic object to the store

func (*MockStore) InsertUser

func (mk *MockStore) InsertUser(uuid string, projects []QProjectRoles, name 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) ModACL

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

ModACL changes the acl in a function

func (*MockStore) ModAck

func (mk *MockStore) ModAck(projectUUID string, name string, ack int) error

ModAck modifies the subscription ack

func (*MockStore) ModSubPush

func (mk *MockStore) ModSubPush(projectUUID string, name string, push string, maxMessages int64, rPolicy string, rPeriod int, vhash string, verified bool) error

ModSubPush modifies the subscription push configuration

func (*MockStore) PaginatedQueryUsers

func (mk *MockStore) PaginatedQueryUsers(pageToken string, pageSize int32, projectUUID string) ([]QUser, int32, string, error)

PaginatedQueryUsers provides query to the list of users using pagination parameters

func (*MockStore) QueryACL

func (mk *MockStore) QueryACL(projectUUID string, resource string, name string) (QAcl, error)

QueryACL Topic/Subscription ACL

func (*MockStore) QueryDailyProjectMsgCount

func (mk *MockStore) QueryDailyProjectMsgCount(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(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(projectUUID string, name string) (QSub, error)

QueryOneSub returns one sub exactly

func (*MockStore) QueryProjects

func (mk *MockStore) QueryProjects(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() []QSub

QueryPushSubs Query push Subscription info from store

func (*MockStore) QuerySchemas

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

func (*MockStore) QuerySubs

func (mk *MockStore) QuerySubs(projectUUID, userUUID, name, pageToken string, pageSize int32) ([]QSub, int32, string, error)

QuerySubs Query Subscription info from store

func (*MockStore) QuerySubsByACL

func (mk *MockStore) QuerySubsByACL(projectUUID, user string) ([]QSub, error)

QuerySubsByACL returns subscriptions that contain a specific user in their ACL

func (*MockStore) QuerySubsByTopic

func (mk *MockStore) QuerySubsByTopic(projectUUID, topic string) ([]QSub, error)

QuerySubsByTopic returns subscriptions attached to a given topic

func (*MockStore) QueryTopics

func (mk *MockStore) QueryTopics(projectUUID, userUUID, name, pageToken string, pageSize int32) ([]QTopic, int32, string, error)

QueryTopics Query Subscription info from store

func (*MockStore) QueryTopicsByACL

func (mk *MockStore) QueryTopicsByACL(projectUUID, user string) ([]QTopic, error)

QueryTopicsByACL returns topics that contain a specific user in their ACL

func (*MockStore) QueryTotalMessagesPerProject

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

func (*MockStore) QueryUsers

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

QueryUsers queries the datastore for user information

func (*MockStore) RemoveFromACL

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

RemoveFromACL removes given users from an existing acl

func (*MockStore) RemoveProject

func (mk *MockStore) RemoveProject(uuid string) error

RemoveProject removes an existing project

func (*MockStore) RemoveProjectSubs

func (mk *MockStore) RemoveProjectSubs(projectUUID string) error

RemoveProjectSubs removes all existing subs belonging to a specific project uuid

func (*MockStore) RemoveProjectTopics

func (mk *MockStore) RemoveProjectTopics(projectUUID string) error

RemoveProjectTopics removes all topics belonging to a specific project uuid

func (*MockStore) RemoveSub

func (mk *MockStore) RemoveSub(projectUUID string, name string) error

RemoveSub removes an existing sub from the store

func (*MockStore) RemoveTopic

func (mk *MockStore) RemoveTopic(projectUUID string, name string) error

RemoveTopic removes an existing topic

func (*MockStore) RemoveUser

func (mk *MockStore) RemoveUser(uuid string) error

RemoveUser removes an existing user

func (*MockStore) UpdateProject

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

UpdateProject updates project information

func (*MockStore) UpdateSchema

func (mk *MockStore) UpdateSchema(schemaUUID, name, schemaType, rawSchemaString string) error

func (*MockStore) UpdateSubConsumeRate

func (mk *MockStore) UpdateSubConsumeRate(projectUUID string, name string, rate float64) error

UpdateSubConsumeRate updates the subscription's consume rate

func (*MockStore) UpdateSubLatestConsume

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

UpdateSubLatestConsume updates the subscription's latest consume time

func (*MockStore) UpdateSubOffset

func (mk *MockStore) UpdateSubOffset(projectUUID string, name string, offset int64)

UpdateSubOffset updates the offset of the current subscription

func (*MockStore) UpdateSubOffsetAck

func (mk *MockStore) UpdateSubOffsetAck(projectUUID string, name string, offset int64, ts string) error

UpdateSubOffsetAck updates the offset of the current subscription

func (*MockStore) UpdateSubPull

func (mk *MockStore) UpdateSubPull(projectUUID string, name string, offset int64, ts string) error

UpdateSubPull updates next offset info after a pull

func (*MockStore) UpdateTopicLatestPublish

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

UpdateTopicLatestPublish updates the topic's latest publish time

func (*MockStore) UpdateTopicPublishRate

func (mk *MockStore) UpdateTopicPublishRate(projectUUID string, name string, rate float64) error

UpdateTopicPublishRate updates the topic's publishing rate

func (*MockStore) UpdateUser

func (mk *MockStore) UpdateUser(uuid string, projects []QProjectRoles, name string, email string, serviceRoles []string, modifiedOn time.Time) error

UpdateUser updates user information

func (*MockStore) UpdateUserToken

func (mk *MockStore) UpdateUserToken(uuid string, token string) error

UpdateUserToken updates user's token

type MongoStore

type MongoStore struct {
	Server   string
	Database string
	Session  *mgo.Session
}

MongoStore holds configuration

func NewMongoStore

func NewMongoStore(server string, db string) *MongoStore

NewMongoStore creates new mongo store

func (*MongoStore) AppendToACL

func (mong *MongoStore) AppendToACL(projectUUID string, resource string, name string, acl []string) error

AppendToACL adds additional users to an existing ACL

func (*MongoStore) AppendToUserProjects

func (mong *MongoStore) AppendToUserProjects(userUUID string, projectUUID string, pRoles ...string) error

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

func (*MongoStore) Clone

func (mong *MongoStore) Clone() Store

Clone the store with a cloned session

func (*MongoStore) Close

func (mong *MongoStore) Close()

Close is used to close session

func (*MongoStore) DeleteSchema

func (mong *MongoStore) DeleteSchema(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 (*MongoStore) ExistsInACL

func (mong *MongoStore) ExistsInACL(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 (*MongoStore) GetAllRoles

func (mong *MongoStore) GetAllRoles() []string

GetAllRoles returns a list of all available roles

func (*MongoStore) GetOpMetrics

func (mong *MongoStore) GetOpMetrics() []QopMetric

GetOpMetrics returns the operational metrics from datastore

func (*MongoStore) GetUserFromToken

func (mong *MongoStore) GetUserFromToken(token string) (QUser, error)

GetUserFromToken returns user information from a specific token

func (*MongoStore) GetUserRoles

func (mong *MongoStore) GetUserRoles(projectUUID string, token string) ([]string, string)

GetUserRoles returns the roles of a user in a project

func (*MongoStore) HasProject

func (mong *MongoStore) HasProject(name string) bool

HasProject Returns true if project exists

func (*MongoStore) HasResourceRoles

func (mong *MongoStore) HasResourceRoles(resource string, roles []string) bool

HasResourceRoles returns the roles of a user in a project

func (*MongoStore) HasUsers

func (mong *MongoStore) HasUsers(projectUUID string, users []string) (bool, []string)

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

func (*MongoStore) IncrementDailyTopicMsgCount

func (mong *MongoStore) IncrementDailyTopicMsgCount(projectUUID string, topicName string, num int64, date time.Time) error

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

func (*MongoStore) IncrementSubBytes

func (mong *MongoStore) IncrementSubBytes(projectUUID string, name string, totalBytes int64) error

IncrementSubBytes increases the total number of bytes consumed from a subscripion

func (*MongoStore) IncrementSubMsgNum

func (mong *MongoStore) IncrementSubMsgNum(projectUUID string, name string, num int64) error

IncrementSubMsgNum increments the number of messages pulled in a subscription

func (*MongoStore) IncrementTopicBytes

func (mong *MongoStore) IncrementTopicBytes(projectUUID string, name string, totalBytes int64) error

IncrementTopicBytes increases the total number of bytes published in a topic

func (*MongoStore) IncrementTopicMsgNum

func (mong *MongoStore) IncrementTopicMsgNum(projectUUID string, name string, num int64) error

IncrementTopicMsgNum increments the number of messages published in a topic

func (*MongoStore) Initialize

func (mong *MongoStore) Initialize()

Initialize initializes the mongo store struct

func (*MongoStore) InsertOpMetric

func (mong *MongoStore) InsertOpMetric(hostname string, cpu float64, mem float64) error

InsertOpMetric inserts an operational metric

func (*MongoStore) InsertProject

func (mong *MongoStore) InsertProject(uuid string, name string, createdOn time.Time, modifiedOn time.Time, createdBy string, description string) error

InsertProject inserts a project to the store

func (*MongoStore) InsertResource

func (mong *MongoStore) InsertResource(col string, res interface{}) error

InsertResource inserts a new topic object to the datastore

func (*MongoStore) InsertSchema

func (mong *MongoStore) InsertSchema(projectUUID, schemaUUID, name, schemaType, rawSchemaString string) error

func (*MongoStore) InsertSub

func (mong *MongoStore) InsertSub(projectUUID string, name string, topic string, offset int64, maxMessages int64, ack int, push string, rPolicy string, rPeriod int, vhash string, verified bool) error

InsertSub inserts a subscription to the store

func (*MongoStore) InsertTopic

func (mong *MongoStore) InsertTopic(projectUUID string, name string, schemaUUID string) error

InsertTopic inserts a topic to the store

func (*MongoStore) InsertUser

func (mong *MongoStore) InsertUser(uuid string, projects []QProjectRoles, name 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 (*MongoStore) ModACL

func (mong *MongoStore) ModACL(projectUUID string, resource string, name string, acl []string) error

ModACL modifies the push configuration

func (*MongoStore) ModAck

func (mong *MongoStore) ModAck(projectUUID string, name string, ack int) error

ModAck modifies the subscription's ack timeout field in mongodb

func (*MongoStore) ModSubPush

func (mong *MongoStore) ModSubPush(projectUUID string, name string, push string, maxMessages int64, rPolicy string, rPeriod int, vhash string, verified bool) error

ModSubPush modifies the push configuration

func (*MongoStore) PaginatedQueryUsers

func (mong *MongoStore) PaginatedQueryUsers(pageToken string, pageSize int32, projectUUID string) ([]QUser, int32, string, error)

PaginatedQueryUsers returns a page of users

func (*MongoStore) QueryACL

func (mong *MongoStore) QueryACL(projectUUID string, resource string, name string) (QAcl, error)

QueryACL queries topic or subscription for a list of authorized users

func (*MongoStore) QueryDailyProjectMsgCount

func (mong *MongoStore) QueryDailyProjectMsgCount(projectUUID string) ([]QDailyProjectMsgCount, error)

QueryDailyProjectMsgCount queries the total messages per day for a given project

func (*MongoStore) QueryDailyTopicMsgCount

func (mong *MongoStore) QueryDailyTopicMsgCount(projectUUID string, topicName string, date time.Time) ([]QDailyTopicMsgCount, error)

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

func (*MongoStore) QueryOneSub

func (mong *MongoStore) QueryOneSub(projectUUID string, name string) (QSub, error)

QueryOneSub queries and returns specific sub of project

func (*MongoStore) QueryProjects

func (mong *MongoStore) QueryProjects(uuid string, name string) ([]QProject, error)

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

func (*MongoStore) QueryPushSubs

func (mong *MongoStore) QueryPushSubs() []QSub

QueryPushSubs retrieves subscriptions that have a push_endpoint defined

func (*MongoStore) QuerySchemas

func (mong *MongoStore) QuerySchemas(projectUUID, schemaUUID, name string) ([]QSchema, error)

func (*MongoStore) QuerySubs

func (mong *MongoStore) QuerySubs(projectUUID, userUUID, name, pageToken string, pageSize int32) ([]QSub, int32, string, error)

QuerySubs Query Subscription info from store

func (*MongoStore) QuerySubsByACL

func (mong *MongoStore) QuerySubsByACL(projectUUID, user string) ([]QSub, error)

QuerySubsByACL returns subscriptions that a specific username has access to

func (*MongoStore) QuerySubsByTopic

func (mong *MongoStore) QuerySubsByTopic(projectUUID, topic string) ([]QSub, error)

QuerySubsByTopic returns subscriptions of a specific topic

func (*MongoStore) QueryTopics

func (mong *MongoStore) QueryTopics(projectUUID, userUUID, name, pageToken string, pageSize int32) ([]QTopic, int32, string, error)

QueryTopics Query Subscription info from store

func (*MongoStore) QueryTopicsByACL

func (mong *MongoStore) QueryTopicsByACL(projectUUID, user string) ([]QTopic, error)

QueryTopicsByACL returns topics that a specific username has access to

func (*MongoStore) QueryTotalMessagesPerProject

func (mong *MongoStore) QueryTotalMessagesPerProject(projectUUIDs []string, startDate time.Time, endDate time.Time) ([]QProjectMessageCount, error)

QueryTotalMessagesPerProject returns the total amount of messages per project for the given time window

func (*MongoStore) QueryUsers

func (mong *MongoStore) QueryUsers(projectUUID string, uuid string, name string) ([]QUser, error)

QueryUsers queries user(s) information belonging to a project

func (*MongoStore) RemoveAll

func (mong *MongoStore) RemoveAll(col string, res interface{}) error

RemoveAll removes all occurences matched with a resource from the store

func (*MongoStore) RemoveFromACL

func (mong *MongoStore) RemoveFromACL(projectUUID string, resource string, name string, acl []string) error

RemoveFromACL remves users for a given ACL

func (*MongoStore) RemoveProject

func (mong *MongoStore) RemoveProject(uuid string) error

RemoveProject removes a project from the store

func (*MongoStore) RemoveProjectSubs

func (mong *MongoStore) RemoveProjectSubs(projectUUID string) error

RemoveProjectSubs removes all subscriptions related to a project UUID

func (*MongoStore) RemoveProjectTopics

func (mong *MongoStore) RemoveProjectTopics(projectUUID string) error

RemoveProjectTopics removes all topics related to a project UUID

func (*MongoStore) RemoveResource

func (mong *MongoStore) RemoveResource(col string, res interface{}) error

RemoveResource removes a resource from the store

func (*MongoStore) RemoveSub

func (mong *MongoStore) RemoveSub(projectUUID string, name string) error

RemoveSub removes a subscription from the store

func (*MongoStore) RemoveTopic

func (mong *MongoStore) RemoveTopic(projectUUID string, name string) error

RemoveTopic removes a topic from the store

func (*MongoStore) RemoveUser

func (mong *MongoStore) RemoveUser(uuid string) error

RemoveUser removes a user entry from the store

func (*MongoStore) UpdateProject

func (mong *MongoStore) UpdateProject(projectUUID string, name string, description string, modifiedOn time.Time) error

UpdateProject updates project information

func (*MongoStore) UpdateSchema

func (mong *MongoStore) UpdateSchema(schemaUUID, name, schemaType, rawSchemaString string) error

UpdateSchema updates the fields of a schema

func (*MongoStore) UpdateSubConsumeRate

func (mong *MongoStore) UpdateSubConsumeRate(projectUUID string, name string, rate float64) error

UpdateSubConsumeRate updates the subscription's consume rate

func (*MongoStore) UpdateSubLatestConsume

func (mong *MongoStore) UpdateSubLatestConsume(projectUUID string, name string, date time.Time) error

UpdateSubLatestConsume updates the subscription's latest consume time

func (*MongoStore) UpdateSubOffset

func (mong *MongoStore) UpdateSubOffset(projectUUID string, name string, offset int64)

UpdateSubOffset updates a subscription offset

func (*MongoStore) UpdateSubOffsetAck

func (mong *MongoStore) UpdateSubOffsetAck(projectUUID string, name string, offset int64, ts string) error

UpdateSubOffsetAck updates a subscription offset after Ack

func (*MongoStore) UpdateSubPull

func (mong *MongoStore) UpdateSubPull(projectUUID string, name string, nextOff int64, ts string) error

UpdateSubPull updates next offset and sets timestamp for Ack

func (*MongoStore) UpdateTopicLatestPublish

func (mong *MongoStore) UpdateTopicLatestPublish(projectUUID string, name string, date time.Time) error

UpdateTopicLatestPublish updates the topic's latest publish time

func (*MongoStore) UpdateTopicPublishRate

func (mong *MongoStore) UpdateTopicPublishRate(projectUUID string, name string, rate float64) error

UpdateTopicPublishRate updates the topic's publishing rate

func (*MongoStore) UpdateUser

func (mong *MongoStore) UpdateUser(uuid string, projects []QProjectRoles, name string, email string, serviceRoles []string, modifiedOn time.Time) error

UpdateUser updates user information

func (*MongoStore) UpdateUserToken

func (mong *MongoStore) UpdateUserToken(uuid string, token string) error

UpdateUserToken updates user's token

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 QProjectRoles

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

QProjectRoles include information about projects and roles that user has

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"`
	PushEndpoint     string      `bson:"push_endpoint"`
	MaxMessages      int64       `bson:"max_messages"`
	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"`
	LatestConsume    time.Time   `bson:"latest_consume"`
	ConsumeRate      float64     `bson:"consume_rate"`
}

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"`
}

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"`
	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 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()
	QuerySubsByTopic(projectUUID, topic string) ([]QSub, error)
	QueryTopicsByACL(projectUUID, user string) ([]QTopic, error)
	QuerySubsByACL(projectUUID, user string) ([]QSub, error)
	QuerySubs(projectUUID string, userUUID string, name string, pageToken string, pageSize int32) ([]QSub, int32, string, error)
	QueryTopics(projectUUID string, userUUID string, name string, pageToken string, pageSize int32) ([]QTopic, int32, string, error)
	QueryDailyTopicMsgCount(projectUUID string, name string, date time.Time) ([]QDailyTopicMsgCount, error)
	UpdateTopicLatestPublish(projectUUID string, name string, date time.Time) error
	UpdateTopicPublishRate(projectUUID string, name string, rate float64) error
	UpdateSubLatestConsume(projectUUID string, name string, date time.Time) error
	UpdateSubConsumeRate(projectUUID string, name string, rate float64) error
	RemoveTopic(projectUUID string, name string) error
	RemoveSub(projectUUID string, name string) error
	PaginatedQueryUsers(pageToken string, pageSize int32, projectUUID string) ([]QUser, int32, string, error)
	QueryUsers(projectUUID string, uuid string, name string) ([]QUser, error)
	UpdateUser(uuid string, projects []QProjectRoles, name string, email string, serviceRoles []string, modifiedOn time.Time) error
	AppendToUserProjects(userUUID string, projectUUID string, pRoles ...string) error
	UpdateUserToken(uuid string, token string) error
	RemoveUser(uuid string) error
	QueryProjects(uuid string, name string) ([]QProject, error)
	UpdateProject(projectUUID string, name string, description string, modifiedOn time.Time) error
	RemoveProject(uuid string) error
	RemoveProjectTopics(projectUUID string) error
	RemoveProjectSubs(projectUUID string) error
	QueryDailyProjectMsgCount(projectUUID string) ([]QDailyProjectMsgCount, error)
	QueryTotalMessagesPerProject(projectUUIDs []string, startDate time.Time, endDate time.Time) ([]QProjectMessageCount, error)
	InsertUser(uuid string, projects []QProjectRoles, name string, token string, email string, serviceRoles []string, createdOn time.Time, modifiedOn time.Time, createdBy string) error
	InsertProject(uuid string, name string, createdOn time.Time, modifiedOn time.Time, createdBy string, description string) error
	InsertOpMetric(hostname string, cpu float64, mem float64) error
	InsertTopic(projectUUID string, name string, schemaUUID string) error
	IncrementTopicMsgNum(projectUUID string, name string, num int64) error
	IncrementDailyTopicMsgCount(projectUUID string, topicName string, num int64, date time.Time) error
	IncrementTopicBytes(projectUUID string, name string, totalBytes int64) error
	IncrementSubBytes(projectUUID string, name string, totalBytes int64) error
	IncrementSubMsgNum(projectUUID string, name string, num int64) error
	InsertSub(projectUUID string, name string, topic string, offest int64, maxMessages int64, ack int, push string, rPolicy string, rPeriod int, vhash string, verified bool) error
	HasProject(name string) bool
	HasUsers(projectUUID string, users []string) (bool, []string)
	QueryOneSub(projectUUID string, name string) (QSub, error)
	QueryPushSubs() []QSub
	HasResourceRoles(resource string, roles []string) bool
	GetOpMetrics() []QopMetric
	GetUserRoles(projectUUID string, token string) ([]string, string)
	GetUserFromToken(token string) (QUser, error)
	UpdateSubOffset(projectUUID string, name string, offset int64)
	UpdateSubPull(projectUUID string, name string, offset int64, ts string) error
	UpdateSubOffsetAck(projectUUID string, name string, offset int64, ts string) error
	ModSubPush(projectUUID string, name string, push string, maxMessages int64, rPolicy string, rPeriod int, vhash string, verified bool) error
	QueryACL(projectUUID string, resource string, name string) (QAcl, error)
	ExistsInACL(projectUUID string, resource string, resourceName string, userUUID string) error
	ModACL(projectUUID string, resource string, name string, acl []string) error
	AppendToACL(projectUUID string, resource string, name string, acl []string) error
	RemoveFromACL(projectUUID string, resource string, name string, acl []string) error
	ModAck(projectUUID string, name string, ack int) error
	GetAllRoles() []string
	InsertSchema(projectUUID, schemaUUID, name, schemaType, rawSchemaString string) error
	QuerySchemas(projectUUID, schemaUUID, name string) ([]QSchema, error)
	UpdateSchema(schemaUUID, name, schemaType, rawSchemaString string) error
	DeleteSchema(schemaUUID string) error
	Clone() Store
	Close()
}

Store encapsulates the generic store interface

Jump to

Keyboard shortcuts

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