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) 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) Raw() any
- type Provider
- type WriterOption
Constants ¶
View Source
const ( MongoDatabaseName = "kubehound" MongoLocalDatabaseURL = "mongodb://localhost:27017" )
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, mp *MongoProvider, 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
}
func NewMongoProvider ¶
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) Raw ¶
func (mp *MongoProvider) Raw() any
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 // Raw returns a handle to the underlying provider to allow implementation specific operations e.g db queries. Raw() 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.