Documentation ¶
Index ¶
- Constants
- type AsyncWriter
- type IndexBuilder
- type MongoAsyncWriter
- type MongoProvider
- func (mp *MongoProvider) BulkWriter(ctx context.Context, collection collections.Collection, opts ...WriterOption) (AsyncWriter, error)
- func (mp *MongoProvider) Clean(ctx context.Context, cluster string, runId string) error
- func (mp *MongoProvider) Close(ctx context.Context) error
- func (mp *MongoProvider) HealthCheck(ctx context.Context) (bool, error)
- func (mp *MongoProvider) Name() string
- func (mp *MongoProvider) Prepare(ctx context.Context) error
- func (mp *MongoProvider) Reader() any
- type Optimization
- type Provider
- type WriterOption
Constants ¶
View Source
const ( MongoDatabaseName = "kubehound" MongoLocalDatabaseURL = "mongodb://localhost:27017" )
View Source
const (
StorageProviderName = "mongodb"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncWriter ¶
type AsyncWriter interface { // Queue add a model to an asynchronous write queue. Non-blocking. Queue(ctx context.Context, model any) error // Flush triggers writes of any remaining items in the queue. Blocks until operation completes. Flush(ctx context.Context) error // Close cleans up any resources used by the AsyncWriter implementation. Writer cannot be reused after this call. Close(ctx context.Context) error }
AysncWriter defines the interface for writer clients to queue aysnchronous, batched writes to the storedb.
type IndexBuilder ¶ added in v1.1.0
type IndexBuilder struct {
// contains filtered or unexported fields
}
IndexBuilder handles the creation of indices for the store collections.
func NewIndexBuilder ¶ added in v1.1.0
func NewIndexBuilder(db *mongo.Database) (*IndexBuilder, error)
NewIndexBuilder creates a new index builder instance for the provided DB.
type MongoAsyncWriter ¶
type MongoAsyncWriter struct {
// contains filtered or unexported fields
}
func NewMongoAsyncWriter ¶
func NewMongoAsyncWriter(ctx context.Context, db *mongo.Database, collection collections.Collection, opts ...WriterOption) *MongoAsyncWriter
func (*MongoAsyncWriter) Close ¶
func (maw *MongoAsyncWriter) Close(ctx context.Context) error
Close cleans up any resources used by the AsyncWriter implementation. Writer cannot be reused after this call.
type MongoProvider ¶
type MongoProvider struct {
// contains filtered or unexported fields
}
A MongoDB based store provider implementation.
func NewMongoProvider ¶
func NewMongoProvider(ctx context.Context, cfg *config.KubehoundConfig) (*MongoProvider, error)
NewMongoProvider creates a new instance of the MongoDB store provider
func (*MongoProvider) BulkWriter ¶
func (mp *MongoProvider) BulkWriter(ctx context.Context, collection collections.Collection, opts ...WriterOption) (AsyncWriter, error)
func (*MongoProvider) HealthCheck ¶
func (mp *MongoProvider) HealthCheck(ctx context.Context) (bool, error)
func (*MongoProvider) Name ¶
func (mp *MongoProvider) Name() string
func (*MongoProvider) Prepare ¶ added in v1.1.0
func (mp *MongoProvider) Prepare(ctx context.Context) error
func (*MongoProvider) Reader ¶ added in v1.2.0
func (mp *MongoProvider) Reader() any
type Optimization ¶ added in v1.2.0
type Optimization int
const ( BalancedOptimization Optimization = iota ReadOptimization WriteOptimization )
type Provider ¶
type Provider interface { services.Dependency // Prepare drops all collections from the database (usually to ensure a clean start) and recreates indices. Prepare(ctx context.Context) error // Droping all assets from the database (usually to ensure a clean start) from a runID and cluster name Clean(ctx context.Context, runId string, cluster string) error // Reader returns a handle to the underlying provider to allow implementation specific queries against the mongo DB Reader() any // BulkWriter creates a new AsyncWriter instance to enable asynchronous bulk inserts. BulkWriter(ctx context.Context, collection collections.Collection, opts ...WriterOption) (AsyncWriter, error) // Close cleans up any resources used by the Provider implementation. Provider cannot be reused after this call. Close(ctx context.Context) error }
Provider defines the interface for implementations of the storedb provider for intermediate storage of normalized K8s data.
type WriterOption ¶
type WriterOption func(*writerOptions)
func WithTags ¶
func WithTags(tags []string) WriterOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.