Documentation ¶
Index ¶
- Variables
- type Crud
- type Db
- type InMemoryHandler
- func (s *InMemoryHandler) Close() error
- func (s *InMemoryHandler) Create(topicCfg *model.TopicConfig) (string, error)
- func (s *InMemoryHandler) Delete(topicFullName, pulsarURL string) (string, error)
- func (s *InMemoryHandler) DeleteByKey(hashedTopicKey string) (string, error)
- func (s *InMemoryHandler) GetByKey(hashedTopicKey string) (*model.TopicConfig, error)
- func (s *InMemoryHandler) GetByTopic(topicFullName, pulsarURL string) (*model.TopicConfig, error)
- func (s *InMemoryHandler) Health() bool
- func (s *InMemoryHandler) Init() error
- func (s *InMemoryHandler) Load() ([]*model.TopicConfig, error)
- func (s *InMemoryHandler) Sync() error
- func (s *InMemoryHandler) Update(topicCfg *model.TopicConfig) (string, error)
- type MongoDb
- func (s *MongoDb) Close() error
- func (s *MongoDb) Create(topicCfg *model.TopicConfig) (string, error)
- func (s *MongoDb) Delete(topicFullName, pulsarURL string) (string, error)
- func (s *MongoDb) DeleteByKey(hashedTopicKey string) (string, error)
- func (s *MongoDb) GetByKey(hashedTopicKey string) (*model.TopicConfig, error)
- func (s *MongoDb) GetByTopic(topicFullName, pulsarURL string) (*model.TopicConfig, error)
- func (s *MongoDb) Health() bool
- func (s *MongoDb) Init() error
- func (s *MongoDb) Load() ([]*model.TopicConfig, error)
- func (s *MongoDb) Sync() error
- func (s *MongoDb) Update(topicCfg *model.TopicConfig) (string, error)
- type Ops
- type PulsarHandler
- func (s *PulsarHandler) Close() error
- func (s *PulsarHandler) Create(topicCfg *model.TopicConfig) (string, error)
- func (s *PulsarHandler) Delete(topicFullName, pulsarURL string) (string, error)
- func (s *PulsarHandler) DeleteByKey(hashedTopicKey string) (string, error)
- func (s *PulsarHandler) GetByKey(hashedTopicKey string) (*model.TopicConfig, error)
- func (s *PulsarHandler) GetByTopic(topicFullName, pulsarURL string) (*model.TopicConfig, error)
- func (s *PulsarHandler) Health() bool
- func (s *PulsarHandler) Init() error
- func (s *PulsarHandler) Load() ([]*model.TopicConfig, error)
- func (s *PulsarHandler) Sync() error
- func (s *PulsarHandler) Update(topicCfg *model.TopicConfig) (string, error)
Constants ¶
This section is empty.
Variables ¶
var DocAlreadyExisted = "document already existed"
DocAlreadyExisted means document already existed in the database when a new creation is requested
var DocNotFound = "no document found"
DocNotFound means no document found in the database
Functions ¶
This section is empty.
Types ¶
type Crud ¶
type Crud interface { GetByTopic(topicFullName, pulsarURL string) (*model.TopicConfig, error) GetByKey(hashedTopicKey string) (*model.TopicConfig, error) Update(topicCfg *model.TopicConfig) (string, error) Create(topicCfg *model.TopicConfig) (string, error) Delete(topicFullName, pulsarURL string) (string, error) DeleteByKey(hashedTopicKey string) (string, error) // Load is invoked by the webhook.go to start new wekbooks and stop deleted ones Load() ([]*model.TopicConfig, error) }
Crud interface specifies typical CRUD opertaions for database
type Db ¶
Db interface embeds two other database interfaces
func NewDbWithPanic ¶
NewDbWithPanic ensures a database is returned panic otherwise
type InMemoryHandler ¶
type InMemoryHandler struct {
// contains filtered or unexported fields
}
InMemoryHandler is the in memory cache driver
func NewInMemoryHandler ¶
func NewInMemoryHandler() (*InMemoryHandler, error)
NewInMemoryHandler initialize a Mongo Db
func (*InMemoryHandler) Create ¶
func (s *InMemoryHandler) Create(topicCfg *model.TopicConfig) (string, error)
Create creates a new document
func (*InMemoryHandler) Delete ¶
func (s *InMemoryHandler) Delete(topicFullName, pulsarURL string) (string, error)
Delete deletes a document
func (*InMemoryHandler) DeleteByKey ¶
func (s *InMemoryHandler) DeleteByKey(hashedTopicKey string) (string, error)
DeleteByKey deletes a document based on key
func (*InMemoryHandler) GetByKey ¶
func (s *InMemoryHandler) GetByKey(hashedTopicKey string) (*model.TopicConfig, error)
GetByKey gets a document by the key
func (*InMemoryHandler) GetByTopic ¶
func (s *InMemoryHandler) GetByTopic(topicFullName, pulsarURL string) (*model.TopicConfig, error)
GetByTopic gets a document by the topic name and pulsar URL
func (*InMemoryHandler) Health ¶
func (s *InMemoryHandler) Health() bool
Health is a Db interface method
func (*InMemoryHandler) Init ¶
func (s *InMemoryHandler) Init() error
Init is a Db interface method.
func (*InMemoryHandler) Load ¶
func (s *InMemoryHandler) Load() ([]*model.TopicConfig, error)
Load loads the entire database as a list
func (*InMemoryHandler) Sync ¶
func (s *InMemoryHandler) Sync() error
Sync is a Db interface method.
func (*InMemoryHandler) Update ¶
func (s *InMemoryHandler) Update(topicCfg *model.TopicConfig) (string, error)
Update updates or creates a topic config document
type MongoDb ¶
type MongoDb struct {
// contains filtered or unexported fields
}
MongoDb is the mongo database driver
func (*MongoDb) Create ¶
func (s *MongoDb) Create(topicCfg *model.TopicConfig) (string, error)
Create creates a new document
func (*MongoDb) DeleteByKey ¶
DeleteByKey deletes a document based on key
func (*MongoDb) GetByKey ¶
func (s *MongoDb) GetByKey(hashedTopicKey string) (*model.TopicConfig, error)
GetByKey gets a document by the key
func (*MongoDb) GetByTopic ¶
func (s *MongoDb) GetByTopic(topicFullName, pulsarURL string) (*model.TopicConfig, error)
GetByTopic gets a document by the topic name and pulsar URL
type PulsarHandler ¶
type PulsarHandler struct { PulsarURL string PulsarToken string TopicName string // contains filtered or unexported fields }
PulsarHandler is the Pulsar database driver
func NewPulsarHandler ¶
func NewPulsarHandler() (*PulsarHandler, error)
NewPulsarHandler initialize a Pulsar Db
func (*PulsarHandler) Create ¶
func (s *PulsarHandler) Create(topicCfg *model.TopicConfig) (string, error)
Create creates a new document
func (*PulsarHandler) Delete ¶
func (s *PulsarHandler) Delete(topicFullName, pulsarURL string) (string, error)
Delete deletes a document
func (*PulsarHandler) DeleteByKey ¶
func (s *PulsarHandler) DeleteByKey(hashedTopicKey string) (string, error)
DeleteByKey deletes a document based on key
func (*PulsarHandler) GetByKey ¶
func (s *PulsarHandler) GetByKey(hashedTopicKey string) (*model.TopicConfig, error)
GetByKey gets a document by the key
func (*PulsarHandler) GetByTopic ¶
func (s *PulsarHandler) GetByTopic(topicFullName, pulsarURL string) (*model.TopicConfig, error)
GetByTopic gets a document by the topic name and pulsar URL
func (*PulsarHandler) Health ¶
func (s *PulsarHandler) Health() bool
Health is a Db interface method
func (*PulsarHandler) Load ¶
func (s *PulsarHandler) Load() ([]*model.TopicConfig, error)
Load loads the entire database into memory
func (*PulsarHandler) Update ¶
func (s *PulsarHandler) Update(topicCfg *model.TopicConfig) (string, error)
Update updates or creates a topic config document