corefdb

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// INDEXFOLDER -INDEXFOLDER
	INDEXFOLDER = "index"
	// LazyCallBackFnAppendBucket - LazyCallBackFnAppendBucket
	LazyCallBackFnAppendBucket = "LazyWriterAppendBucketCallBackFn"
	// LazyCallBackFnSaveIndex - LazyCallBackFnSaveIndex
	LazyCallBackFnSaveIndex = "LazyWriterCallBackFnAppendBucketSaveIndex"

	IndexKeyValSeperator    = "="
	FileType                = "fileType"
	MigrationTypeUpdate     = "MigrationTypeUpdate"
	MigrationTypeReplace    = "MigrationTypeReplace"
	MigrationTypeKeyword    = "migrationType"
	MigrationConfigFilename = "migrationConfig"
	PathSeperator           = "/"
	LookupTypeReference     = "Reference"

	// DhawalD - New Constants Added - 31-July-2021
	QueryOperatorOR  = "OR"
	QueryOperatorAND = "AND"
)

Variables

View Source
var ErrNoDataFound = errors.New("data not found")

ErrNoDataFound - This error describes that the required data might be deleted and not found. Kindly ignore this error in caller.

View Source
var IsDebugModeOn bool

Functions

func AddIndexEntriesInFile

func AddIndexEntriesInFile(indexFilePath string, entries map[string]string, securityProvider securityprovider.SecurityProvider) error

AddIndexEntriesInFile -AddIndexEntriesInFile

func DeleteDataFromFDB

func DeleteDataFromFDB(dbName, indexID string, rs *gjson.Result, queries []string, infileIndexQueries []string) (recordsDeletedCnt int, errList []error)

func GenRowID

func GenRowID(name string) (string, error)

GenRowID generates hash for the given filename. The length of hash is 16

func GetFilePaths

func GetFilePaths(dbName, indexID string, queries []string) ([]string, error)

func GetMediaFromFDB

func GetMediaFromFDB(dbName, indexID string, rowID, recordID string) (dataByte []byte, fileMeta gjson.Result, err error)

func ImportIndexEntries

func ImportIndexEntries(indexFilePath string, fdb *FDB, indexID string) error

ImportIndexEntries -

func ReadDataFromFDB

func ReadDataFromFDB(dbName, indexID string, data *gjson.Result, queries []string, infileIndexQueries []string) (*gjson.Result, error)

func ReorganizeFDBBucketData

func ReorganizeFDBBucketData(dbName, indexId string, queries []string) (errList []error)

func ReorganizeFiles

func ReorganizeFiles(dbName string) (errList []error)

func SaveDataInFDB

func SaveDataInFDB(dbName string, indexID string, data *gjson.Result) error

func SaveMediaInFDB

func SaveMediaInFDB(dbName, indexID string, mediaData []byte, data *gjson.Result) (recordPath string, err error)

func UpdateDataInFDB

func UpdateDataInFDB(dbName, indexID string, data *gjson.Result, queries []string, infileIndexQueries []string) (*gjson.Result, []error)

func UpdateMediaInFDB

func UpdateMediaInFDB(dbName, indexID, recordID string, mediaData []byte, rs *gjson.Result) (string, error)

func UpsertMediaInFDB

func UpsertMediaInFDB(dbName, indexID, recordID string, mediaData []byte, rs *gjson.Result) (string, error)

Types

type FDB

type FDB struct {
	DBName            string
	DBPath            string `json:"dbPath"`
	EnableSecurity    bool   `json:"enableSec"` // if enabled, fdb files will be encrypted
	EnableCompression bool   `json:"enableCmp"` // if enabled, fdb files will be compressed and then encrypted
	// contains filtered or unexported fields
}

FDB - FDB

func CreateFDBInstance

func CreateFDBInstance(dbPath, dbName string, isDefault bool) (*FDB, error)

CreateFDBInstance - creates fdb instance

func GetFDBInstance

func GetFDBInstance(dbName string) (*FDB, error)

GetFDBInstance - returns fdb instance

func (*FDB) AddBucket

func (fdb *FDB) AddBucket(bucketID string, bucketObj bucket.Store) error

func (*FDB) EnableFDBSecurity

func (fdb *FDB) EnableFDBSecurity(sec bool)

EnableFDBSecurity enables security. Files will be encrypted.

func (*FDB) GetFDBBucketStore

func (f *FDB) GetFDBBucketStore(bucketID string) (bucket.Store, bool)

GetFDBBucketStore - returns bucket

func (*FDB) GetFDBIndex

func (f *FDB) GetFDBIndex(indexID string) (*index.Index, bool)

GetFDBIndex - returns index

func (*FDB) RegisterNewIndex

func (fdb *FDB) RegisterNewIndex(indexID, indexNameQuery string, isDynamicName bool, indexFields []index.IndexField) (*index.Index, error)

RegisterNewIndex - RegisterNewIndex returns new index

func (*FDB) ResolvePath

func (fdb *FDB) ResolvePath(index *index.Index, rs *gjson.Result) (string, error)

func (*FDB) SetSecurityProvider

func (fdb *FDB) SetSecurityProvider(securityProvider securityprovider.SecurityProvider) error

type FileExporter

type FileExporter struct {
	FdbName       string
	IndexID       string
	Queries       []string
	DestPath      string
	MigrationType string
	QueryOperator string
}

FileExporter is a DataExporter allow to export fdb data in a folder DhawalD - added QueryOperator - 31-July-2021

func (FileExporter) DataExport

func (f FileExporter) DataExport() (err error)

DataExport exports fdb data in a folder

type FileImporter

type FileImporter struct {
	FdbName    string
	IndexID    string
	SourcePath string
	Data       *gjson.Result
}

FileImporter is a DataImporter allow to import fdb data from exported folder

func (FileImporter) DataImport

func (f FileImporter) DataImport() (err error)

DataImport imports data from exported folder

type ZipExporter

type ZipExporter struct {
	FdbName       string
	IndexID       string
	Queries       []string
	DestPath      string
	MigrationType string
	QueryOperator string
}

ZipExporter is a DataExporter allow to export fdb data as zip DhawalD - added QueryOperator - 31-July-2021

func (ZipExporter) DataExport

func (z ZipExporter) DataExport() (err error)

DataExport exports fdb data as zip

type ZipImporter

type ZipImporter struct {
	FdbName    string
	IndexID    string
	SourcePath string
	Data       *gjson.Result
}

func (ZipImporter) DataImport

func (z ZipImporter) DataImport() (err error)

DataImport imports data from zip

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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