badger

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

depo-badger - Factory wrappers for dgraph-io/badger

codecov Build Status GoDoc

Overview

This project contains wrappers for *badger.DB from dgraph-io/badger that make it easier to integrate with projects using our application framework stackopsd/app or other systems built on our dependency orchestration library stackopsd/depo.

How To Use

This project includes a factory named Factory that constructs instances of *badger.DB.

reg := app.NewRegistry()
reg.Add(app.TypeDriver, new(badger.Factory))

Developing

Make targets

This project includes a Makefile that makes it easier to develop on the project. The following are the included targets:

  • fmt

    Format all Go code using goimports.

  • generate

    Regenerate any generated code. See gen.go for code generation commands.

  • lint

    Run golangci-lint using the included linter configurations.

  • test

    Run all unit tests for the project and generate a coverage report.

  • integration

    Run all integration tests for the project and generate a coverage report.

  • coverage

    Generate a combined coverage report from the test and integration target outputs.

  • update

    Update all project dependencies to their latest versions.

  • tools

    Generate a local bin/ directory that contains all of the tools used to lint, test, and format, etc.

  • updatetools

    Update all project ools to their latest versions.

  • vendor

    Generate a vendor directory.

  • clean/cleancoverage/cleantools/cleanvendor

    Remove files created by the Makefile. This does not affect any code changes you may have made.

License

Copyright 2019 Kevin Conway

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Dir      string `description:"Dir is the path of the directory where key data will be stored in."`
	ValueDir string `description:"ValueDir is the path of the directory where value data will be stored in."`

	SyncWrites          bool   `` /* 166-byte string literal not displayed */
	TableLoadingMode    string `description:"TableLoadingMode indicates which file loading mode should be used for the LSM tree data files."`
	ValueLogLoadingMode string `description:"ValueLogLoadingMode indicates which file loading mode should be used for the value log data files."`
	NumVersionsToKeep   int    `description:"NumVersionsToKeep sets how many versions to keep per key at most."`
	ReadOnly            bool   `description:"When ReadOnly is true the DB will be opened on read-only mode."`
	Truncate            bool   `description:"Truncate indicates whether value log files should be truncated to delete corrupt data, if any."`

	MaxTableSize        int64 `description:"MaxTableSize sets the maximum size in bytes for each LSM table or file."`
	LevelSizeMultiplier int   `description:"LevelSizeMultiplier sets the ratio between the maximum sizes of contiguous levels in the LSM."`
	MaxLevels           int   `description:"Maximum number of levels of compaction allowed in the LSM."`
	ValueThreshold      int   `` /* 151-byte string literal not displayed */
	NumMemtables        int   `description:"NumMemtables sets the maximum number of tables to keep in memory before stalling."`

	NumLevelZeroTables      int `description:"NumLevelZeroTables sets the maximum number of Level 0 tables before compaction starts."`
	NumLevelZeroTablesStall int `` /* 139-byte string literal not displayed */

	LevelOneSize       int64  `description:"LevelOneSize sets the maximum total size for Level 1."`
	ValueLogFileSize   int64  `description:"ValueLogFileSize sets the maximum size of a single value log file."`
	ValueLogMaxEntries uint32 `description:"ValueLogMaxEntries sets the maximum number of entries a value log file can hold approximately."`

	NumCompactors     int   `description:"NumCompactors sets the number of compaction workers to run concurrently."`
	CompactL0OnClose  bool  `description:"CompactL0OnClose determines whether Level 0 should be compacted before closing the DB."`
	LogRotatesToFlush int32 `description:"LogRotatesToFlush sets the number of value log file rotates after which the Memtables are flushed to disk."`
}

Config contains the settings for Badger database.

type Factory

type Factory struct{}

Factory produces Badger databases.

func (*Factory) Config

func (c *Factory) Config(context.Context) *Config

Settings generates the default configuration.

func (*Factory) Make

func (c *Factory) Make(ctx context.Context, conf *Config) (*badger.DB, error)

Make constructs and instance of the factory output.

Jump to

Keyboard shortcuts

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