docstore

package
v5.0.0-...-2679821 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

README

DocStore Service

This service provides a simple, indexed key/value store for both JSON documents and Binaries. Documents are stored in a BoltDB database, and indexed (and thus searchable) using Bleve full-text search engine.

API

GRPC Handler provides the following service

service DocStore {
    rpc PutDocument (PutDocumentRequest) returns (PutDocumentResponse) {};
    rpc GetDocument (GetDocumentRequest) returns (GetDocumentResponse) {};
    rpc DeleteDocuments (DeleteDocumentsRequest) returns (DeleteDocumentsResponse) {};
    rpc CountDocuments(ListDocumentsRequest) returns (CountDocumentsResponse) {};
    rpc ListDocuments(ListDocumentsRequest) returns (stream ListDocumentsResponse) {};
}

Documents objects are use the following model:

message Document {
    string ID = 2;
    DocumentType Type = 3;
    string Owner = 4;
    bytes Data = 5;
    bytes IndexableMeta = 6;
}

Data can contain a JSON serialized string that will be actually stored, whereas IndexableMeta contains JSON that will be indexed by the search engine. This metadata can have many level depth, and keys can then be searched with Bleve query string like "Key1: value" or "+Key1.SubKey:value*"

Binaries

Binary documents are redirected at the gateway level to a dedicated S3 bucket defined in the configuration. Binary are then served directly via S3.

Documentation

Overview

Package docstore provides an indexed JSON document store.

It is used by various services to store their data instead of implementing yet-another persistence layer. It uses a combination of Bolt for storage and Bleve for indexation.

Index

Constants

This section is empty.

Variables

View Source
var (
	Drivers = service.StorageDrivers{}
)

Functions

func Migrate

func Migrate(ctx, fromCtx, toCtx context.Context, dryRun bool, status chan service.MigratorStatus) (map[string]int, error)

Types

type DAO

type DAO interface {
	PutDocument(ctx context.Context, storeID string, doc *docstore.Document) error
	GetDocument(ctx context.Context, storeID string, docId string) (*docstore.Document, error)
	DeleteDocument(ctx context.Context, storeID string, docID string) error
	DeleteDocuments(ctx context.Context, storeID string, query *docstore.DocumentQuery) (int, error)
	QueryDocuments(ctx context.Context, storeID string, query *docstore.DocumentQuery) (chan *docstore.Document, error)
	CountDocuments(ctx context.Context, storeID string, query *docstore.DocumentQuery) (int, error)
	ListStores(ctx context.Context) ([]string, error)
	CloseAndDrop(ctx context.Context) error
	Reset() error
}

Directories

Path Synopsis
dao
service
Package service exposes the document store api in GRPC
Package service exposes the document store api in GRPC

Jump to

Keyboard shortcuts

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