bundlestore

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

README

Bundlestore

Overview

Stores are the way we persist and retrieve bundles. They deal with the moving of bundle data, not its generation in any way. The storage may be local or remote, and for simplicity we don't expose that detail. Functions may perform special processing and caching that differ from store to store.

There are a few different store types that handle bundles differently. They can use bundles in memory, bundles on disk, and bundles located behind an http server. Further, we can wrap these stores in a parent store to add additional business logic to our handling.

Bundle name conventions

  • HTTP Bundlestore server - For now names look like 'bs-.bundle'

Server

Server makes a store accessible via http and doesn't do much else at this time. Future work includes ex: bundle validation, and generating better bundles with a different basis.

The use case for server is motivated by snapshot/git/gitdb. which needs to upload/download bundles from persistent storage and does so by contacting this [off-box] server via httpStore. Note that the server in turn may use httpStore internally to talk to, for instance, a SAN.

Server API
GET

Example:

curl -X GET -o local-output.bundle http://localhost:9094/bundle/bs-0000000000000000000000000000000000000000.bundle
POST

Example:

curl -X POST --data-binary "@/abspath/local-input.bundle" http://localhost:9094/bundle/bs-0000000000000000000000000000000000000000.bundle

Documentation

Index

Constants

View Source
const (
	// Store-related environment variables
	BundlestoreDirEnvVar = "BUNDLESTORE_STORE_DIR"

	// Maximum concurrent connections allowed to access underlying Store resources
	MaxConnections = 100

	// Addrs
	DefaultApiBundlestore_HTTP = "localhost:9094"

	ApiBundlestorePorts = 11100
)

Variables

This section is empty.

Functions

func DefaultStore

func DefaultStore(store *store.FileStore) store.Store

func Defaults

func Defaults() *ice.MagicBag

Creates a MagicBag for a default bundlestore server and returns it

func MakeFileStoreInEnvOrTemp

func MakeFileStoreInEnvOrTemp() (*store.FileStore, error)

Make a File Store based on the environment, or in temp if unset

func MakeHTTPServer

func MakeHTTPServer(cfg *store.StoreConfig) *httpServer

func Module

func Module() ice.Module

Module returns a module that supports serving Bundlestore

func RunServer

func RunServer(bag *ice.MagicBag, schema jsonconfig.Schema, config []byte)

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Represents a Bundlestore Server that serves HTTP over an underlying Store with shared configuration and stats. StoreConfig is in part as a simplified solution to 2 problems golang-related problems we have with our current architecture: - values of Store and StatsReceiver interfaces don't pass down cleanly because of cyclic dependency rules

func MakeServer

func MakeServer(s store.Store, ttl *store.TTLConfig, stat stats.StatsReceiver) *Server

Make a new server that delegates to an underlying store. TTL may be nil, in which case defaults are applied downstream. TTL may be overridden by request headers, but we always pass this TTLKey to the store.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

Implements http.Handler interface

Jump to

Keyboard shortcuts

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