mongodop

package module
v0.0.0-...-b2878b1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBucketName is the default name for a bucket in MongoDB.
	DefaultBucketName         = "diskhop"
	DefaultDBName             = "diskhop"
	DefaultNameCollectionName = "name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IVPusher

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

IVPusher is a struct that will push an initialization vector to the store.

func (*IVPusher) Exists

func (ivp *IVPusher) Exists(ctx context.Context, iv []byte) (bool, error)

Exists will check if an initialization vector exists in the store.

func (*IVPusher) Push

func (ivp *IVPusher) Push(ctx context.Context, iv []byte) error

Push will push an initialization vector to the store.

type Migrator

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

Migrator is a store.EncPusher that migrates files from one MongoDB gridfs bucket to another.

func ConnectMigrator

func ConnectMigrator(ctx context.Context, connStr string, db, srcB, targB string) (*Migrator, error)

ConnectMigrator connects to the MongoDB server and returns a new Migrator.

func (*Migrator) Push

func (up *Migrator) Push(
	ctx context.Context,
	name string,
	r io.ReadSeeker,
	opts ...store.PushOption,
) (string, error)

PushEnc migrates the file with the given name from the source bucket to the target bucket.

type Pusher

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

func (*Pusher) Push

func (p *Pusher) Push(ctx context.Context, name string, r io.ReadSeeker, opts ...store.PushOption) (string, error)

Push pushes an object to the store.

type Store

type Store struct {
	Pusher
	// contains filtered or unexported fields
}

Store is a MongoDB database for pushing and pulling data from local disk.

func Connect

func Connect(ctx context.Context, connStr, db, bucketName string) (*Store, error)

Connect will establish a connection to a MongoDB database.

func (*Store) AddCommit

func (s *Store) AddCommit(_ context.Context, commit *store.Commit)

func (*Store) Close

func (s *Store) Close(ctx context.Context) error

Close will flush the nameIndex.

func (*Store) EncryptedPull

func (s *Store) EncryptedPull(
	ctx context.Context,
	buf store.DocumentBuffer,
	setters ...store.PullOption,
) (*store.PullDescription, error)

PullEnc will retrieve a slice of encrypted documents from a remote host.

func (*Store) FlushCommits

func (s *Store) FlushCommits(ctx context.Context) error

func (*Store) GetIVManager

func (s *Store) GetIVManager() dcrypto.IVManager

GetIVManager will return an IVManager.

func (*Store) Pull

func (s *Store) Pull(ctx context.Context, buf store.DocumentBuffer, setters ...store.PullOption) (*store.PullDescription, error)

Pull will retrieve a slice of documents from a remote host.

func (*Store) Revert

func (s *Store) Revert(ctx context.Context, sha string) error

Revert will revert the store to a previous state.

Jump to

Keyboard shortcuts

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