s3ds

package module
v0.11.0 Latest Latest
Warning

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

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

README

S3 Datastore Implementation

This is an implementation of the datastore interface backed by amazon s3.

NOTE: Plugins only work on Linux and MacOS at the moment. You can track the progress of this issue here: https://github.com/golang/go/issues/19282

Quickstart

  1. Grab a plugin release from the releases section matching your Kubo version and install the plugin file in ~/.ipfs/plugins.
  2. Follow the instructions in the plugin's README.md

Building and installing

The plugin can be manually built/installed for different versions of Kubo (starting with 0.23.0) with:

git checkout go-ds-s3-plugin/v<kubo-version>
make plugin
make install-plugin

Updating to a new version

  1. go get the Kubo release you want to build for. Make sure any other dependencies are aligned to what Kubo uses.
  2. make install and test.

If you are building against dist-released versions of Kubo, you need to build using the same version of go that was used to build the release (here).

If you are building against your own build of Kubo you must align your plugin to use it.

If you are updating this repo to produce a new version of the plugin:

  1. Submit a PR so that integration tests run
  2. Make a new tag go-ds-s3-plugin/v<kubo_version> and push it. This will build and release the plugin prebuilt binaries.

Bundling

As go plugins can be finicky to correctly compile and install, you may want to consider bundling this plugin and re-building kubo. If you do it this way, you won't need to install the .so file in your local repo, i.e following the above Building and Installing section, and you won't need to worry about getting all the versions to match up.

# We use go modules for everything.
> export GO111MODULE=on

# Clone kubo.
> git clone https://github.com/ipfs/kubo
> cd kubo

# Pull in the datastore plugin (you can specify a version other than latest if you'd like).
> go get github.com/chixodo-xyz/go-ds-s3/plugin@latest

# Add the plugin to the preload list.
> echo -en "\ns3ds github.com/chixodo-xyz/go-ds-s3/plugin 0" >> plugin/loader/preload_list

# ( this first pass will fail ) Try to build kubo with the plugin
> make build

# Update the deptree
> go mod tidy

# Now rebuild kubo with the plugin
> make build

# (Optionally) install kubo
> make install

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

Want to hack on IPFS?

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AccessKey           string
	SecretKey           string
	SessionToken        string
	Bucket              string
	Region              string
	RegionEndpoint      string
	RootDirectory       string
	Workers             int
	CredentialsEndpoint string
}

type S3Bucket

type S3Bucket struct {
	Config
	S3 *s3.S3
}

func NewS3Datastore

func NewS3Datastore(conf Config) (*S3Bucket, error)

func (*S3Bucket) Batch

func (s *S3Bucket) Batch(_ context.Context) (ds.Batch, error)

func (*S3Bucket) Close

func (s *S3Bucket) Close() error

func (*S3Bucket) Delete

func (s *S3Bucket) Delete(ctx context.Context, k ds.Key) error

func (*S3Bucket) Get

func (s *S3Bucket) Get(ctx context.Context, k ds.Key) ([]byte, error)

func (*S3Bucket) GetSize

func (s *S3Bucket) GetSize(ctx context.Context, k ds.Key) (size int, err error)

func (*S3Bucket) Has

func (s *S3Bucket) Has(ctx context.Context, k ds.Key) (exists bool, err error)

func (*S3Bucket) Put

func (s *S3Bucket) Put(ctx context.Context, k ds.Key, value []byte) error

func (*S3Bucket) Query

func (s *S3Bucket) Query(ctx context.Context, q dsq.Query) (dsq.Results, error)

func (*S3Bucket) Sync

func (s *S3Bucket) Sync(ctx context.Context, prefix ds.Key) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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