distribution/docs/storage-drivers/index.md
Misty Stanley-Jones 8c922b0c8c Revert "Merge pull request #437 from gdevillele/fix_keywords_format"
This reverts commit 13ddc1350ea1edafcb03d4db901823604a5d1ec1, reversing
changes made to 7a11f05943cc62d040dcfedc7621fdeafd11c718.
2016-11-04 13:33:29 -07:00

3.4 KiB

aliases description keywords menu title
/registry/storagedrivers/
Explains how to use storage drivers
registry, on-prem, images, tags, repository, distribution, storage drivers, advanced
main
identifier parent weight
storage_index smn_storagedrivers -1
Storage Driver overview

Docker Registry Storage Driver

This document describes the registry storage driver model, implementation, and explains how to contribute new storage drivers.

Provided Drivers

This storage driver package comes bundled with several drivers:

Storage Driver API

The storage driver API is designed to model a filesystem-like key/value storage in a manner abstract enough to support a range of drivers from the local filesystem to Amazon S3 or other distributed object storage systems.

Storage drivers are required to implement the storagedriver.StorageDriver interface provided in storagedriver.go, which includes methods for reading, writing, and deleting content, as well as listing child objects of a specified prefix key.

Storage drivers are intended to be written in Go, providing compile-time validation of the storagedriver.StorageDriver interface.

Driver Selection and Configuration

The preferred method of selecting a storage driver is using the StorageDriverFactory interface in the storagedriver/factory package. These factories provide a common interface for constructing storage drivers with a parameters map. The factory model is based off of the Register and Open methods in the builtin database/sql package.

Storage driver factories may be registered by name using the factory.Register method, and then later invoked by calling factory.Create with a driver name and parameters map. If no such storage driver can be found, factory.Create will return an InvalidStorageDriverError.

Driver Contribution

Writing new storage drivers

To create a valid storage driver, one must implement the storagedriver.StorageDriver interface and make sure to expose this driver via the factory system.

Registering

Storage drivers should call factory.Register with their driver name in an init method, allowing callers of factory.New to construct instances of this driver without requiring modification of imports throughout the codebase.

Testing

Storage driver test suites are provided in storagedriver/testsuites/testsuites.go and may be used for any storage driver written in Go. Tests can be registered using the RegisterSuite function, which run the same set of tests for any registered drivers.