mongodb

package
v0.0.0-...-ca3ac9b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package mongodb using a mongo db as a index engine for the search

Index

Constants

View Source
const MongoIndex = "mongodb"

MongoIndex name of the index component

Variables

This section is empty.

Functions

func CloseMongoDB

func CloseMongoDB()

CloseMongoDB closing the connection to mongo

func InitMongoDB

func InitMongoDB(p map[string]any) error

InitMongoDB initialize the mongo db for usage in this service

func ToMongoQuery

func ToMongoQuery(q query.Query) string

ToMongoQuery converting a blobstorage query into a mango query

Types

type Config

type Config struct {
	Hosts        []string `yaml:"hosts"`
	Database     string   `yaml:"database"`
	AuthDatabase string   `yaml:"authdatabase"`
	Username     string   `yaml:"username"`
	Password     string   `yaml:"password"`
}

Config configuration to the mongodb instance

type Index

type Index struct {
	Tenant string
	// contains filtered or unexported fields
}

Index one index for a tenant

func (*Index) Index

func (m *Index) Index(id string, b model.BlobDescription) error

Index indexing a single blob

func (*Index) Init

func (m *Index) Init() error

Init initialisation of one tenant mongo indexer

func (*Index) NewBatch

func (m *Index) NewBatch() interfaces.IndexBatch

NewBatch creating a new batch for bulk index

func (*Index) Search

func (m *Index) Search(qry string, callback func(id string) bool) error

Search doing a search against the mongodb

type IndexBatch

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

IndexBatch using batch functionality for indexing

func (*IndexBatch) Add

Add adding a single blob description to a batch

func (*IndexBatch) Index

func (i *IndexBatch) Index() error

Index index all blobs in this batch TODO should use an mongo bulk operation

type MongoBlobDescription

type MongoBlobDescription struct {
	model.BlobDescription
	ID primitive.ObjectID `bson:"_id,omitempty"`
}

MongoBlobDescription the mongo blob description object

Jump to

Keyboard shortcuts

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