Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Registry = make(map[string]PluginFunc)
Registry contains all the registered plugins
Functions ¶
Types ¶
type ChainFunc ¶
type ChainFunc func(PipelineFunc) PipelineFunc
type ClientConnection ¶
type ClientConnection struct {
// Address of client connection
Addr net.Addr
// According to the docs (https://docs.mongodb.com/manual/core/authentication/#authentication-methods) multiple logins should
// have the credentials for all until a logout happens; for now we aren't doing that.
Identities []ClientIdentity
// Map is storage that resets on cursor change
Map map[interface{}]interface{}
}
func NewClientConnection ¶
func NewClientConnection() *ClientConnection
func (*ClientConnection) Close ¶
func (c *ClientConnection) Close()
func (*ClientConnection) GetAddr ¶
func (c *ClientConnection) GetAddr() string
func (*ClientConnection) GetIpAddr ¶ added in v0.0.9
func (c *ClientConnection) GetIpAddr() string
func (*ClientConnection) GetUsername ¶ added in v0.0.9
func (c *ClientConnection) GetUsername() string
type ClientIdentity ¶
type CursorCache ¶
type CursorCache interface {
GetCursor(cursorID int64) *CursorCacheEntry
CloseCursor(cursorID int64)
}
type CursorCacheEntry ¶
type CursorCacheEntry struct {
ID int64
CursorConsumed int
// Map is storage that resets on cursor change
Map map[interface{}]interface{}
}
func NewCursorCacheEntry ¶
func NewCursorCacheEntry(id int64) *CursorCacheEntry
type PipelineFunc ¶
PipelineFunc is the function type for the built pipeline, and is called to begin the pipeline.
func BuildPipeline ¶
func BuildPipeline(m []Plugin, base PipelineFunc) PipelineFunc
BuildPipeline takes a plugin chain and creates a pipeline, returning a PipelineFunc that starts the pipeline when called.
type Plugin ¶
type Plugin interface {
// Name returns the name for the given plugin
Name() string
// Configure configures this plugin with the given configuration object. Returns
// an error if the configuration is invalid for the plugin.
Configure(bson.D) error
// Process is the function executed when a message is called in the pipeline.
Process(context.Context, *Request, PipelineFunc) (bson.D, error)
}
type Request ¶
type Request struct {
CC *ClientConnection
CursorCache
CommandName string
Command command.Command
// Map of arbitrary data for plugins to store stuff in
Map map[string]interface{}
}
Request encapsulates a mongo request
type StaticIdentity ¶
type StaticIdentity struct {
T string `bson"type"`
U string `bson:"user"`
RS []string `bson:"roles"`
}
func NewStaticIdentity ¶
func NewStaticIdentity(t, u string, rs ...string) *StaticIdentity
func (*StaticIdentity) Roles ¶
func (i *StaticIdentity) Roles() []string
func (*StaticIdentity) Type ¶
func (i *StaticIdentity) Type() string
func (*StaticIdentity) User ¶
func (i *StaticIdentity) User() string
Click to show internal directories.
Click to hide internal directories.