Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

kyleconroy/blobstore

Repository files navigation

stakmachine/blobstore

GoDoc Build Status

Install

This repository does not include a vendor directory, so you'll need to use dep to manage your dependencies.

dep ensure github.com/stackmachine/blobstore

Usage

package main

import (
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/s3"
	"github.com/stackmachine/blobstore"
)

func main() {
	// Create a store backed by an S3 bucket
	sess := session.Must(session.NewSession())
	bucket := blobstore.NewS3(s3.New(session), "example-bucket-name")

	// Create another store backed by a local folder
	fs, _ := blobstore.NewFileSystem("cas")

	// Limit the size of this folder to 500MB
	lru := blobstore.LRU(int64(500)*1e+6, fs)

	// Sychnorize access to the LRU store
	cache := blobstore.NewSynchronized(lru)

	// Use the filesystem to cache the S3 bucket
	store := blobstore.Cached(main, cache)

	// Start all keys with a shared prefix
	final := blobstore.Prefixed("prefix", store)
}

About

Store and retrieve binary blobs from memory, the filesystem, S3, and more.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages