Awesome Open Source
Awesome Open Source

storage

Build Status Go dev License Join the chat

An application-oriented unified storage layer for Golang.

Goal

  • Production ready
  • High performance
  • Vendor agnostic

Features

Widely services support

Servicer operation support

  • List: list all Storager in service
  • Get: get a Storager via name
  • Create: create a Storager
  • Delete: delete a Storager

Storager operation support

Basic operations

  • Metadata: get storager metadata
  • Read: read file content
  • Write: write content into file
  • Stat: get file's metadata
  • Delete: delete a file or directory
  • List: list file in prefix or dir styles

Extended operations

  • Copy: copy a file inside storager
  • Move: move a file inside storager
  • Reach: generate a public accessible url

Multi object modes support

  • Multipart: allow doing multipart uploads
  • Append: allow appending to an object
  • Block: allow combining an object with block ids.
  • Page: allow doing random writes

Object metadata support

Common metadata

  • id: unique key in service
  • name: relative path towards service's work dir
  • type: object type cloud be file, dir, link or unknown

Optional metadata

  • size: object's content size.
  • updated-at: object's last updated time.
  • content-md5: md5 digest as defined in rfc2616
  • content-type: media type as defined in rfc2616
  • etag: entity tag as defined in rfc2616
  • storage-class: object's storage class as defined in storage proposal

Quick Start

import (
    "log"

    "github.com/aos-dev/go-storage/v3"
    "github.com/aos-dev/go-storage/v3/pairs"
    "github.com/aos-dev/go-services-fs"
)

// Init a service.
store, err := fs.NewStorager(pairs.WithWorkDir("/tmp"))
if err != nil {
    log.Fatalf("service init failed: %v", err)
}

// Use Storager API to maintain data.
var buf bytes.Buffer

n, err := store.Read("path/to/file", &buf)
if err != nil {
    log.Printf("storager read: %v", err)
}

Sponsor


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
go (14,435
golang (3,676
storage (248
s3 (191
files (72
dropbox (63
cloud-storage (45
fs (29

Find Open Source By Browsing 7,000 Topics Across 59 Categories