mongodb

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host         string `envconfig:"SUBSTORE_MONGO_HOST" default:"localhost:27017"`
	DatabaseName string `envconfig:"SUBSTORE_MONGO_DATABASE" default:"cloud2cloudGateway"`
	// contains filtered or unexported fields
}

type DBSub

type DBSub struct {
	ID             string `bson:"_id"`
	URL            string
	CorrelationID  string // uuid
	Type           store.Type
	Accept         []string
	EventTypes     events.EventTypes
	DeviceID       string `bson:"deviceid"`
	Href           string `bson:"href"`
	SequenceNumber uint64 `bson:"sequencenumber"`
	UserID         string `bson:"userid"`
	SigningSecret  string
}

type Option

type Option func(Config) Config

Option provides the means to use function call chaining

func WithTLS

func WithTLS(cfg *tls.Config) Option

WithTLS configures connection to use TLS

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements an Store for MongoDB.

func NewStore

func NewStore(ctx context.Context, cfg Config, opts ...Option) (*Store, error)

NewStore creates a new Store.

func NewStoreWithSession

func NewStoreWithSession(ctx context.Context, client *mongo.Client, dbPrefix string) (*Store, error)

NewStoreWithSession creates a new Store with a session.

func (*Store) Clear

func (s *Store) Clear(ctx context.Context) error

Clear clears the event storage.

func (*Store) Close

func (s *Store) Close(ctx context.Context) error

Close closes the database session.

func (*Store) DBName

func (s *Store) DBName() string

DBName returns db name

func (*Store) IncrementSubscriptionSequenceNumber

func (s *Store) IncrementSubscriptionSequenceNumber(ctx context.Context, subscriptionID string) (uint64, error)

func (*Store) LoadSubscriptions

func (s *Store) LoadSubscriptions(ctx context.Context, query store.SubscriptionQuery, h store.SubscriptionHandler) error

func (*Store) PopSubscription

func (s *Store) PopSubscription(ctx context.Context, subscriptionID string) (sub store.Subscription, err error)

func (*Store) SaveSubscription

func (s *Store) SaveSubscription(ctx context.Context, sub store.Subscription) error

Jump to

Keyboard shortcuts

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