surgeon

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearFreelist

func ClearFreelist(path string) error

func ClearPage

func ClearPage(path string, pgId common.Pgid) (bool, error)

func ClearPageElements

func ClearPageElements(path string, pgId common.Pgid, start, end int, abandonFreelist bool) (bool, error)

ClearPageElements supports clearing elements in both branch and leaf pages. Note if the ${abandonFreelist} is true, the freelist may be cleaned in the meta pages in the following two cases, and bbolt needs to scan the db to reconstruct free list. It may cause some delay on next startup, depending on the db size.

  1. Any branch elements are cleared;
  2. An object saved in overflow pages is cleared;

Usually ${abandonFreelist} defaults to false, it means it will not clear the freelist in meta pages automatically. Users will receive a warning message to remind them to explicitly execute `bbolt surgery abandom-freelist` afterwards; the first return parameter will be true in such case. But if the freelist isn't synced at all, no warning message will be displayed.

func CopyPage

func CopyPage(path string, srcPage common.Pgid, target common.Pgid) error

func RevertMetaPage

func RevertMetaPage(path string) error

RevertMetaPage replaces the newer metadata page with the older. It usually means that one transaction is being lost. But frequently data corruption happens on the last transaction pages and the previous state is consistent.

Types

type XRay

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

func NewXRay

func NewXRay(path string) XRay

func (XRay) FindPathsToKey

func (n XRay) FindPathsToKey(key []byte) ([][]common.Pgid, error)

FindPathsToKey finds all paths from root to the page that contains the given key. As it traverses multiple buckets, so in theory there might be multiple keys with the given name. Note: For simplicity it's currently implemented as traversing of the whole reachable tree. If key is a bucket name, a page-path referencing the key will be returned as well.

Jump to

Keyboard shortcuts

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