47 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)) {
80 if (secondary_ft && secondary_nc) {
81 os <<
", requested FileTrack+NetCache";
82 }
else if (secondary_ft) {
83 os <<
", requested FileTrack";
84 }
else if (secondary_nc) {
85 os <<
", requested NetCache";
86 }
else if (
flags && !movable) {
87 os <<
", zero requested backends";
93 os <<
"configured FileTrack+NetCache";
95 os <<
"configured FileTrack";
97 os <<
"configured NetCache";
99 os <<
"no configured backends";
106 template <
class TCaller>
109 auto i = m_Locations.begin();
110 auto last =
prev(m_Locations.end());
114 return caller(
i->get());
123 if (
i++ ==
last)
break;
126 m_Locations.splice(m_Locations.end(), m_Locations, m_Locations.begin());
129 return caller(&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)) {
234 current += bytes_read;
237 size_t bytes_written;
241 data += bytes_written;
242 bytes_read -= bytes_written;
246 if (rw_state->Eof())
break;
248 if (current >=
max) {
255 progress.
SetString(
"Message",
"Relocating");
263 "Request to interrupt Relocate has been received.");
274 return new_file--->GetLoc();
352 if (!rw_state)
throw 0;
367 if (
typeid(*
l) ==
typeid(*current))
throw 0;
398 return SNetStorageObjectImpl::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