leo_object_storage_server¶
The object storage server.
Behaviours: `gen_server <gen_server.html>`__.
References
Description¶
The object storage server
Function Index¶
add_incorrect_data/2 | Store metadata and data. |
append_compaction_history/2 | Append the history in the state. |
close/1 | Close the object-container. |
code_change/3 | Convert process state when code is changed. |
delete/2 | Remove an object from the object-storage - (logical-delete). |
fetch/4 | Retrieve objects from the object-storage by Key and Function. |
get/4 | Retrieve an object from the object-storage. |
get_avs_version_bin/1 | Get AVS format version binary like “LeoFS AVS-2.2”. |
get_backend_info/2 | Retrieve object-storage/metadata-storage info. |
get_compaction_worker/1 | Retrieve the compaction worker. |
get_stats/1 | Retrieve the storage stats specfied by Id which contains number of objects and so on. |
handle_call/3 | gen_server callback - Module:handle_call(Request, From, State) -> Result. |
handle_cast/2 | Handling cast message. |
handle_info/2 | Handling all non call/cast messages. |
head/2 | Retrieve an object’s metadata from the object-storage. |
head_with_calc_md5/3 | Retrieve a metada/data from backend_db/object-storage AND calc MD5 based on the body data. |
init/1 | Initiates the server. |
lock/1 | Retrieve object-storage/metadata-storage info. |
put/2 | Insert an object and an object’s metadata into the object-storage. |
set_stats/2 | Retrieve the storage stats specfied by Id which contains number of objects and so on. |
start_link/6 | Starts the server. |
start_link/7 | Starts the server with strict-check. |
stop/1 | Stop this server. |
store/3 | Store metadata and data. |
switch_container/4 | Open the object-container. |
terminate/2 | This function is called by a gen_server when it is about to terminate. |
Function Details¶
add_incorrect_data/2¶
Store metadata and data
append_compaction_history/2¶
append_compaction_history(Id, History) -> ok
- Id = atom()
- History = tuple()
Append the history in the state
code_change/3¶
code_change(OldVsn, State, Extra) -> any()
Convert process state when code is changed
delete/2¶
delete(Id, Object) -> ok | {error, any()}
- Id = atom()
- Object = #'?OBJECT'{}
Remove an object from the object-storage - (logical-delete)
fetch/4¶
fetch(Id, Key, Fun, MaxKeys) -> {ok, list()} | {error, any()}
- Id = atom()
- Key = any()
- Fun = function()
- MaxKeys = non_neg_integer() | undefined
Retrieve objects from the object-storage by Key and Function
get/4¶
get(Id, AddrIdAndKey, StartPos, EndPos) -> {ok, #'?METADATA'{}, #'?OBJECT'{}} | not_found | {error, any()}
- Id = atom()
- AddrIdAndKey = addrid_and_key()
- StartPos = non_neg_integer()
- EndPos = non_neg_integer()
Retrieve an object from the object-storage
get_avs_version_bin/1¶
get_avs_version_bin(Id) -> ok
- Id = atom()
Get AVS format version binary like “LeoFS AVS-2.2”
get_backend_info/2¶
get_backend_info(Id, ServerType) -> {ok, #backend_info{}}
- Id = atom()
- ServerType = '?SERVER_OBJ_STORAGE'
Retrieve object-storage/metadata-storage info
get_compaction_worker/1¶
get_compaction_worker(Id) -> {ok, CompactionWorkerId}
- Id = atom()
- CompactionWorkerId = atom()
Retrieve the compaction worker
get_stats/1¶
get_stats(Id) -> {ok, #storage_stats{}} | {error, any()}
- Id = atom()
Retrieve the storage stats specfied by Id which contains number of objects and so on.
handle_call/3¶
handle_call(X1, From, State) -> any()
gen_server callback - Module:handle_call(Request, From, State) -> Result
handle_cast/2¶
handle_cast(Msg, State) -> any()
Handling cast message
gen_server callback - Module:handle_cast(Request, State) -> Result.
handle_info/2¶
handle_info(Info, State) -> any()
Handling all non call/cast messages
gen_server callback - Module:handle_info(Info, State) -> Result.
head/2¶
head(Id, AddrIdAndKey) -> {ok, binary()} | not_found | {error, any()}
- Id = atom()
- AddrIdAndKey = addrid_and_key()
Retrieve an object’s metadata from the object-storage
head_with_calc_md5/3¶
head_with_calc_md5(Id, Key, MD5Context) -> {ok, #'?METADATA'{}, any()} | {error, any()}
- Id = atom()
- Key = tuple()
- MD5Context = any()
Retrieve a metada/data from backend_db/object-storage AND calc MD5 based on the body data
put/2¶
put(Id, Object) -> ok | {error, any()}
- Id = atom()
- Object = #'?OBJECT'{}
Insert an object and an object’s metadata into the object-storage
set_stats/2¶
set_stats(Id, StorageStats) -> ok
- Id = atom()
- StorageStats = #storage_stats{}
Retrieve the storage stats specfied by Id which contains number of objects and so on.
start_link/6¶
start_link(Id, SeqNo, MetaDBId, CompactionWorkerId, DiagnosisLogId, RootPath) -> {ok, pid()} | {error, any()}
- Id = atom()
- SeqNo = non_neg_integer()
- MetaDBId = atom()
- CompactionWorkerId = atom()
- DiagnosisLogId = atom()
- RootPath = string()
Starts the server
start_link/7¶
start_link(Id, SeqNo, MetaDBId, CompactionWorkerId, DiagnosisLogId, RootPath, IsStrictCheck) -> {ok, pid()} | {error, any()}
- Id = atom()
- SeqNo = non_neg_integer()
- MetaDBId = atom()
- CompactionWorkerId = atom()
- DiagnosisLogId = atom()
- RootPath = string()
- IsStrictCheck = boolean()
Starts the server with strict-check
store/3¶
store(Id, Metadata, Bin) -> ok | {error, any()}
- Id = atom()
- Metadata = #'?METADATA'{}
- Bin = binary()
Store metadata and data
switch_container/4¶
switch_container(Id, FilePath, NumOfActiveObjs, SizeOfActiveObjs) -> ok
- Id = atom()
- FilePath = string()
- NumOfActiveObjs = non_neg_integer()
- SizeOfActiveObjs = non_neg_integer()
Open the object-container
terminate/2¶
terminate(Reason, State) -> any()
This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason.