You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Eric's Object Storage Service(EOSS) is my experimental object storage service. I designed EOSS with following features:
support object versioning
support HTTP HEAD/GET/PUT/DELETE methods for object operations
support object writing operation rollback if failure occurs
support safe mode
support concurrent writing
object metadata and object files should be easy to move around
EOSS uses local filesystem as the storage layer.
Technical Details
Components
EOSS has 3 pieces of components: EOSS Service, Metadata Database and Storage Layer. EOSS Service is a Flask application that is written by Python 3. Metadata Database uses SQLite to store the object metadata. Storage Layer is local filesystem or local-mounted NFS share.
Metadata Database Schema
Metadata Database(MDS) uses SQLite as the metadata store.
Column Name
Type
Description
id
String
object name
filename
String
object original filename
version
String
object version
size
Integer
object size
timestamp
Integer
latest updated timestamp
state
Integer
object writing state
Object Versioning
To support object versioning, the user needs to specify a special string calledversion salt, this version salt will be used to construct the final version string by base64 method. Once the user passes version string by using the headerX-EOSS-Object-Version, EOSS will construct the a string in the following format:
<object filename>:<version salt>:<version string>
then EOSS applies base64 method on the string as the final object name. Here's an example:
The version salt should not be shared with end users.
Object Writing State
EOSS uses 3 integers to object writing states. In each phase, EOSS will update MDS with proper state integer. When an object is uploading, following phases are triggered:
set an exclusive lock on a lock file with a ".lock" suffix in object name in storage layer
object writing request initialized
object data is saved with a ".temp" suffix in object name in storage layer
object file is renamed to the final object name
Number
Description
1
initial state - object writing request initialized
2
object is saved on storage layer with a temp suffix
0
final state - object is renamed to final object name
Object Writing Operation Rollback
In order to avoid inconsistent state left if uploading is failed, a rollback operation is necessary to ensure all writing is atomic. Rollback feature only exists in uploading function(HTTP PUT method).
If any MDS update or object storing operations go wrong, the rollback function will be triggered. The rollback function will delete the data on the storage layer first then removing the object record from MDS.
If rollback is failed, it's possible the service is still in inconsistent state. But such leftover states would be cleaned up when service restarts.
Object Concurrent Write
EOSS utilizes a simplified Two-Phase Locking mechanism to address concurrent write scenarios. Prior to initiating the actual write, an exclusive lock is placed on a lock file. Instead of waiting for the transaction to complete, EOSS promptly returns an HTTP response code 409 to the client, indicating the detection of concurrent writes and advising the client to retry at a later time.
Safe Mode
Safe Mode is a special operational mode in EOSS. Once Safe Mode is enabled, all READ operations(HTTP HEAD and GET methods) is still working but all WRITE(HTTP PUT and DELETE methods) operations would be failed.
This feature is useful when service administrator needs to maintain the service but not interrupting users to read objects.
HTTP Response Codes
EOSS obeys most standard HTTP response codes. Following table lists EOSS customized HTTP response codes:
HTTP Response Code
Text
Description
409
Object Read/Write Conflict
read or write on the same object that has exclusive lock
440
Object Initialized Only
object is just initialized, not ready for serving
441
Object Saved Not Closed
object is saved with a temp suffix, not ready for serving
520
MDS Connection Failure
failed to connect MDS
521
MDS Execution Failure
failed to execute SQL queries on MDS
522
MDS Commit Failure
failed to commit transactions to MDS
523
EOSS Internal Exception Failure
EOSS encounters exceptions that are unable to catch
524
EOSS Inconsistent Condition Failure
EOSS encounters internal inconsistency issue
525
EOSS Safemode Enabled
Safe Mode is enabled on EOSS
526
EOSS Rollback Done
Rollback procedure is successful
527
EOSS Rollback Failed
Rollback procedure is failed
HTTP Endpoints
Each HTTP response from EOSS would have a special header calledX-EOSS-Request-ID which is used to identify source request.
/eoss/v1/object
object endpoint is used for users to handle object operations like download/upload/delete.
HTTP HEAD Method
HTTP HEAD method is used for checking if object exists or not.
Modifyconfig_file_path variable insrc/eoss/__init__.py to specify correct location foreoss.yaml.
Modify theconfig/eoss.yaml configuration file with proper settings. The file controls EOSS backend service settings.
VERSION_SALT: object version salt. default value is the stringsnoopy
STROAGE_PATH: file path location to store objects
METADATA_DB_PATH: metadata database file location
METADATA_DB_TABLE: metadata database table name. default value is the stringmetadata
OBJECT_LOCK_PATH: file path location to store lock files of objects
LOGGING_PATH: EOSS service logging path to store log files
LOG_BACKUP_COUNT: logging rotation count. default value is 10
LOG_MAX_BYTES: maximum size of each log file. default value is 1 GB
SAFEMODE: safe mode flag. default value isFalse
Modify theconfig/eoss-uwsgi.ini configuration file with proper settings. This file controls EOSS HTTP service settings.
chdir: file path that pointssrc directory
Go tosrc directory and runbootstrap-env.py command. This command will bootstrap and create metadata database and necessary directories.
Go tosrc directory and runstart.sh to start EOSS service. This script will triggerpre-start.py first to check and clean up EOSS environment then it will bring up the WSGI HTTP service.