m_NotFound(m_ObjectLoc, fsm),
56 if(primary_ft || secondary_ft || movable) {
58 if(ft->Init())
m_Locations.emplace_back(ft.release());
61 if(primary_nc || secondary_nc || movable) {
63 if(nc->Init())
m_Locations.emplace_back(nc.release());
66 if(primary_nc || (!primary_ft && !secondary_ft && secondary_nc)) {
73 const boolft =
m_Context->filetrack_api;
74 const boolnc =
m_Context->icache_client;
80 if(secondary_ft && secondary_nc) {
81os <<
", requested FileTrack+NetCache";
82}
else if(secondary_ft) {
83os <<
", requested FileTrack";
84}
else if(secondary_nc) {
85os <<
", requested NetCache";
86}
else if(
flags&& !movable) {
87os <<
", zero requested backends";
93os <<
"configured FileTrack+NetCache";
95os <<
"configured FileTrack";
97os <<
"configured NetCache";
99os <<
"no configured backends";
106 template<
classTCaller>
107 auto CObj::Meta(TCaller caller) -> decltype(caller(
nullptr))
109 auto i= m_Locations.begin();
110 auto last=
prev(m_Locations.end());
114 returncaller(
i->get());
123 if(
i++ ==
last)
break;
126m_Locations.splice(m_Locations.end(), m_Locations, m_Locations.begin());
129 returncaller(&m_NotFound);
142 "Attribute support is only implemented in NetStorage server.");
149 "Attribute support is only implemented in NetStorage server.");
156 "Attribute support is only implemented in NetStorage server.");
193 "Timeout during "<< what <<
" on relocate");
197 "IO error during "<< what <<
" on relocate");
201 "Non-implemented operation called during "<< what <<
" on relocate");
228 if(
typeid(src) ==
typeid(dst)) {
234current += bytes_read;
237 size_tbytes_written;
240 s_Check(new_file--->
Write(
data, bytes_read, &bytes_written),
"writing");
241 data+= bytes_written;
242bytes_read -= bytes_written;
246 if(rw_state->Eof())
break;
248 if(current >=
max) {
254progress.
SetInteger(
"BytesRelocated", total);
255progress.
SetString(
"Message",
"Relocating");
263 "Request to interrupt Relocate has been received.");
271new_file--->
Close();
274 returnnew_file--->GetLoc();
352 if(!rw_state)
throw0;
367 if(
typeid(*
l) ==
typeid(*current))
throw0;
398 returnSNetStorageObjectImpl::CreateAndStart<CObj>(
l,
m_Context, loc,
flags);
void SetString(const string &key, const string &value)
Set a JSON object element to the specified string value.
void SetInteger(const string &key, Int8 value)
Set a JSON object element to the specified integer value.
static CJsonNode NewObjectNode()
Create a new JSON object node.
Exception class for use by CNetStorage, CNetStorageByKey, and CNetStorageObject.
Detailed information about a CNetStorage object.
void SetStorageAttrFlags(TNetStorageAttrFlags flags)
string GetLocator() const
Basic network-based data object I/O.
CTimeout â Timeout interval.
SNetStorageObjectImpl * Clone(TNetStorageFlags flags, CObj **copy)
CNetStorageObjectLoc & Locator() override
ERW_Result Read(void *, size_t, size_t *) override
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
void RemoveOldCopyIfExists(ILocation *current)
string GetAttribute(const string &) const override
ERW_Result Write(const void *, size_t, size_t *) override
Write up to "count" bytes from the buffer pointed to by the "buf" argument onto the output device.
void SetAttribute(const string &, const string &) override
void CancelRelocate() override
list< unique_ptr< ILocation > > m_Locations
CNetStorageObjectInfo GetInfo() override
string FileTrack_Path() override
list< string > GetAttributeList() const override
CRef< SContext > m_Context
void SetExpiration(const CTimeout &) override
CNetStorageObjectLoc m_ObjectLoc
CObj(SNetStorageObjectImpl &fsm, SContext *context, const CNetStorageObjectLoc &loc, TNetStorageFlags flags, bool is_opened=false, ENetStorageObjectLocation location=eNFL_Unknown)
string Relocate(TNetStorageFlags, TNetStorageProgressCb cb) override
auto Meta(TCaller caller) -> decltype(caller(nullptr))
ENetStorageRemoveResult Remove() override
pair< string, string > GetUserInfo() override
string GetLoc() const override
INetStorageObjectState * StartRead(void *, size_t, size_t *, ERW_Result *)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char location[]
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
unsigned TNetStorageFlags
Bitwise OR of ENetStorageFlags.
ENetStorageObjectLocation
Enumeration that indicates the current location of the object.
function< void(CJsonNode)> TNetStorageProgressCb
Progress callback.
ENetStorageRemoveResult
Result returned by Remove() methods.
@ fNST_NetCache
Use NetCache as the primary storage.
@ fNST_FileTrack
Use FileTrack as the primary storage.
@ fNST_Movable
Allow the object to move between storages.
@ eNotExists
Illegal op applied to non-existent object.
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
ERW_Result
Result codes for I/O operations.
@ eRW_NotImplemented
Action / information is not available.
@ eRW_Eof
End of data, should be considered permanent.
@ eRW_Error
Unrecoverable error, no retry possible.
@ eRW_Timeout
Timeout expired, try again later.
@ eRW_Success
Everything is okay, I/O completed.
void s_Check(ERW_Result result, const char *what)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void EnterState(INetStorageObjectState *state)
static CS_CONTEXT * context
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4