objectstore

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: GPL-3.0 Imports: 13 Imported by: 6

README

object-store

Library for storing records in Google cloud storage

Badges

Go Report Card Go Doc

Documentation

Overview

Package objectstore provides persistent key-value storage, using Google cloud storage to persist the data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValueOperation

type KeyValueOperation func(string, []byte)

KeyValueOperation allows you to interact with a given key, value pair.

type ObjectStore

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

ObjectStore provides operations on the set of data in an ObjectStore. Use New to get a handle.

func New

func New(ctx context.Context, client *storage.Client, bucketName, filePrefix string) (*ObjectStore, error)

New will load the current state of an ObjectStore from the given bucket and prefix and return an ObjectStore handle for performing actions.

func (*ObjectStore) Delete

func (os *ObjectStore) Delete(ctx context.Context, key string) error

Delete removes a value for a given key.

func (*ObjectStore) ForEach

func (os *ObjectStore) ForEach(op KeyValueOperation)

ForEach performs operation op on all key, value pairs in the ObjectStore. Note that all of these operations are run from inside a read lock so you will not be able to perform Insert/Delete operation.

func (*ObjectStore) Get

func (os *ObjectStore) Get(key string) []byte

Get returns the value associated with a given key.

func (*ObjectStore) Insert

func (os *ObjectStore) Insert(ctx context.Context, key string, object []byte) error

Insert adds or updates a value for a given key. If the key is already used this new value will replace the existing value.

func (*ObjectStore) InsertBulk

func (os *ObjectStore) InsertBulk(ctx context.Context, index map[string][]byte) error

InsertBulk adds, updates, or deletes a group of key-values together.

Directories

Path Synopsis
internal
schema
Package schema provides the on disk format for github.com/nthnca/object-store
Package schema provides the on disk format for github.com/nthnca/object-store

Jump to

Keyboard shortcuts

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