mmlist

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: GPL-2.0 Imports: 7 Imported by: 1

Documentation

Overview

A Memory Mapped List. This list works more like a stack and less like a queue. It is not a good thing to build a job queue on. It is a good thing to build a large set of items which can be efficiently randomly sampled. It uses the same `varchar` system that the B+Tree uses so it can store variably sized items up to 2^31 - 1 bytes long.

Operations

1. `Size` O(1)

2. `Append` O(1)

3. `Pop` O(1)

4. `Get` O(1)

5. `Set` O(1)

6. `Swap` O(1)

7. `SwapDelete` O(1)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

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

func New

func New(bf *fmap.BlockFile) (*List, error)

func NewAt

func NewAt(bf *fmap.BlockFile, ctrl_a uint64) (*List, error)

func Open

func Open(bf *fmap.BlockFile) (*List, error)

func OpenAt

func OpenAt(bf *fmap.BlockFile, ctrl_a uint64) (*List, error)

func (*List) Append

func (l *List) Append(item []byte) (i uint64, err error)

func (*List) Get

func (l *List) Get(i uint64) (item []byte, err error)

func (*List) Pop

func (l *List) Pop() (item []byte, err error)

func (*List) Set

func (l *List) Set(i uint64, item []byte) (err error)

func (*List) Size

func (l *List) Size() uint64

func (*List) Swap

func (l *List) Swap(i, j uint64) (err error)

func (*List) SwapDelete

func (l *List) SwapDelete(i uint64) (item []byte, err error)

Jump to

Keyboard shortcuts

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