omnistorage

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 11 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

OmniStorage

Go CI Go Lint Go SAST Go Report Card Docs Visualization License

Unified storage abstraction layer for Go. This is an aggregator package that re-exports the core interfaces from omnistorage-core and imports all provider backends for automatic registration.

Installation

go get github.com/plexusone/omnistorage

Quick Start

import (
    "github.com/plexusone/omnistorage"
)

// All backends are automatically registered via init()
backend, err := omnistorage.Open("s3", map[string]string{
    "bucket": "my-bucket",
    "region": "us-east-1",
})

Included Backends

All 9 backends are automatically registered when you import this package:

Core Backends (from omnistorage-core)
Backend Registry Name Description
File file Local filesystem storage
Memory memory In-memory storage (testing)
Channel channel Go channel-based IPC
SFTP sftp SSH file transfer
Dropbox dropbox Dropbox cloud storage
Cloud Backends (from omni-* packages)
Backend Provider Registry Name
Amazon S3 omni-aws s3
GitHub Releases omni-github github
Google Cloud Storage omni-google gcs
Google Drive omni-google drive

Key-Value Storage

KVS interfaces are re-exported for caching, state management, and structured data:

SQLite Backend
import "github.com/plexusone/omnistorage/kvs/sqlite"

store, _ := sqlite.New(sqlite.Config{Path: "data.db"})
store.Set(ctx, "user:123", userData, 24*time.Hour)
Redis Backend
import "github.com/plexusone/omnistorage/kvs/redis"

store, _ := redis.New(redis.Config{Addr: "localhost:6379"})
store.Set(ctx, "cache:key", data, time.Hour)
In-Memory Backend
import "github.com/plexusone/omnistorage/kvs/memory"

store := memory.New()
store.Set(ctx, "temp:key", data, 5*time.Minute)

Session Storage

Secure, backend-agnostic server-side session management with size limits, JSON validation, and observability hooks:

In-Memory Sessions (Development)
import (
    "github.com/plexusone/omnistorage/session"
    "github.com/plexusone/omnistorage/session/backend/memory"
)

store := memory.New()
sess := session.NewSession("user-123")
store.Save(ctx, sess)
KVS-Backed Sessions (Production)

Use any KVS backend (Redis, SQLite) for persistent sessions:

import (
    "github.com/plexusone/omnistorage/session"
    "github.com/plexusone/omnistorage/session/backend/kvs"
    "github.com/plexusone/omnistorage/kvs/redis"
)

redisStore, _ := redis.New(redis.DefaultConfig())
sessionStore := kvs.New(redisStore)

sess := session.NewSession("user-123")
sessionStore.Save(ctx, sess)
Session Controls

Add size limits and violation handling:

import "github.com/plexusone/omnistorage/session/backend/memory"

store := memory.NewWithControls(
    session.WithControls(session.Config{
        MaxSessionSize: 1 << 20, // 1MB limit
        MaxSessions:    1000,
    }),
    session.WithViolationHandler(func(e session.ViolationEvent) {
        log.Printf("session violation: %s", e.Type)
    }),
)

Minimal Dependencies

For minimal dependencies, import omnistorage-core directly:

import "github.com/plexusone/omnistorage-core"

// Gets: file, memory, channel, sftp, dropbox (no cloud SDKs)
backend, err := omnistorage.Open("file", map[string]string{"root": "/data"})

Or import only specific backends:

import (
    "github.com/plexusone/omnistorage-core/object"
    _ "github.com/plexusone/omni-aws/omnistorage/backend/s3"
)

backend, err := object.Open("s3", map[string]string{
    "bucket": "my-bucket",
    "region": "us-east-1",
})

Documentation

License

MIT

Documentation

Overview

Package omnistorage provides a unified storage abstraction layer for Go.

This is an aggregator package that re-exports the core interfaces from omnistorage-core and imports all provider backends for automatic registration.

For minimal dependencies, import omnistorage-core directly and only the specific provider backends you need.

Object Storage

For file/blob storage (documents, media, backups):

import (
    "github.com/plexusone/omnistorage"
    _ "github.com/plexusone/omni-aws/omnistorage/backend/s3"
)

backend, _ := omnistorage.Open("s3", map[string]string{
    "bucket": "my-bucket",
    "region": "us-east-1",
})

Key-Value Storage

For session state, caching, and structured data:

import (
    "github.com/plexusone/omnistorage"
    "github.com/plexusone/omnistorage/kvs/sqlite"
)

store, _ := sqlite.New(sqlite.Config{Path: "data.db"})
store.Set(ctx, "session:123", data, time.Hour)

The kvs.Store interface is re-exported as omnistorage.Store.

Index

Constants

View Source
const (
	HashMD5    = object.HashMD5
	HashSHA1   = object.HashSHA1
	HashSHA256 = object.HashSHA256
	HashCRC32C = object.HashCRC32C
)

Re-export hash types.

Variables

View Source
var (
	ErrKVSNotFound = kvs.ErrNotFound
	ErrKVSClosed   = kvs.ErrClosed
)

Re-export kvs errors.

View Source
var (
	// Register registers a backend factory.
	Register = object.Register

	// Open creates a backend from the registry.
	Open = object.Open

	// WithContentType sets the content type for a writer.
	WithContentType = object.WithContentType

	// WithMetadata sets metadata for a writer.
	WithMetadata = object.WithMetadata

	// WithOffset sets the read offset.
	WithOffset = object.WithOffset

	// WithLimit sets the read limit.
	WithLimit = object.WithLimit

	// ApplyWriterOptions applies writer options.
	ApplyWriterOptions = object.ApplyWriterOptions

	// ApplyReaderOptions applies reader options.
	ApplyReaderOptions = object.ApplyReaderOptions
)

Re-export core functions.

View Source
var (
	ErrNotFound         = object.ErrNotFound
	ErrPermissionDenied = object.ErrPermissionDenied
	ErrBackendClosed    = object.ErrBackendClosed
	ErrNotSupported     = object.ErrNotSupported
	ErrInvalidPath      = object.ErrInvalidPath
	ErrWriterClosed     = object.ErrWriterClosed
)

Re-export core errors.

Functions

This section is empty.

Types

type Backend

type Backend = object.Backend

Backend represents a storage backend (S3, GCS, local file, etc.).

type Document added in v0.2.0

type Document = kvs.Document

Document represents a stored document.

type DocumentStore added in v0.2.0

type DocumentStore = kvs.DocumentStore

DocumentStore extends Store with document operations.

type ExtendedBackend

type ExtendedBackend = object.ExtendedBackend

ExtendedBackend extends Backend with additional operations.

type Features

type Features = object.Features

Features describes capabilities of a backend.

type HashType

type HashType = object.HashType

HashType identifies a hash algorithm.

type KVSConfig added in v0.2.0

type KVSConfig = kvs.Config

Config configures storage creation.

type ListableStore added in v0.2.0

type ListableStore = kvs.ListableStore

ListableStore extends Store with key listing.

type ObjectInfo

type ObjectInfo = object.ObjectInfo

ObjectInfo contains metadata about a stored object.

type ReaderOption

type ReaderOption = object.ReaderOption

ReaderOption configures a reader.

type RecordReader

type RecordReader = object.RecordReader

RecordReader reads framed records from an underlying reader.

type RecordWriter

type RecordWriter = object.RecordWriter

RecordWriter writes framed records to an underlying writer.

type Store added in v0.2.0

type Store = kvs.Store

Store is the primary key-value storage interface.

type WriterOption

type WriterOption = object.WriterOption

WriterOption configures a writer.

Directories

Path Synopsis
kvs
memory
Package memory re-exports the in-memory key-value storage backend.
Package memory re-exports the in-memory key-value storage backend.
redis
Package redis re-exports the Redis key-value storage backend.
Package redis re-exports the Redis key-value storage backend.
sqlite
Package sqlite re-exports the SQLite key-value storage backend.
Package sqlite re-exports the SQLite key-value storage backend.
Package session re-exports the session storage interface and controls.
Package session re-exports the session storage interface and controls.
backend/kvs
Package kvs re-exports the KVS-backed session storage backend.
Package kvs re-exports the KVS-backed session storage backend.
backend/memory
Package memory re-exports the in-memory session storage backend.
Package memory re-exports the in-memory session storage backend.

Jump to

Keyboard shortcuts

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