Code Monkey home page Code Monkey logo

go-storage's Introduction

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's metadata
  • Read: read file content
  • Write: write content into file
  • Stat: get file's metadata
  • Delete: delete a file or directory

Extended operations

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

Multiple list style support

  • ListDir: list files and directories under a directory
  • ListPrefix: list files under a prefix

Segment/Multipart support

  • ListPrefixSegment: list segments under a prefix
  • InitIndexSegment: initiate an index type segment
  • WriteIndexSegment: write content into an index type segment
  • CompleteSegment: complete a segment to create a file
  • AbortSegment: abort a segment

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/v2"
    "github.com/aos-dev/go-storage/v2/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

go-storage's People

Contributors

xuanwo avatar prnyself avatar dependabot-preview[bot] avatar dependabot[bot] avatar ccamel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.