SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Rename.h
Go to the documentation of this file.
1
/*
2
* SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3
* License details at <https://github.com/kashirin-alex/swc-db/#license>
4
*/
5
6
7
#ifndef swcdb_fsbroker_handlers_Rename_h
8
#define swcdb_fsbroker_handlers_Rename_h
9
10
#include "
swcdb/fs/Broker/Protocol/params/Rename.h
"
11
12
13
namespace
SWC
{
namespace
Comm {
namespace
Protocol {
14
namespace
FsBroker {
namespace
Handler {
15
16
17
void
rename
(
const
ConnHandlerPtr
& conn,
const
Event::Ptr
& ev) {
18
19
int
err =
Error::OK
;
20
try
{
21
22
const
uint8_t *ptr = ev->data.base;
23
size_t
remain = ev->data.size;
24
25
Params::RenameReq
params;
26
params.
decode
(&ptr, &remain);
27
28
Env::FsInterface::fs
()->rename(err, params.
from
, params.
to
);
29
30
}
catch
(...) {
31
const
Error::Exception
& e =
SWC_CURRENT_EXCEPTION
(
""
);
32
SWC_LOG_OUT
(
LOG_ERROR
,
SWC_LOG_OSTREAM
<< e; );
33
err = e.
code
();
34
}
35
36
auto
cbp =
Buffers::make
(ev, 4);
37
cbp->append_i32(err);
38
conn->send_response(cbp);
39
40
}
41
42
43
}}}}}
44
45
#endif // swcdb_fsbroker_handlers_Rename_h
SWC::Error::Exception::code
constexpr SWC_CAN_INLINE int code() const noexcept
Definition:
Exception.h:51
SWC_LOG_OSTREAM
#define SWC_LOG_OSTREAM
Definition:
Logger.h:44
SWC_LOG_OUT
#define SWC_LOG_OUT(pr, _code_)
Definition:
Logger.h:178
SWC::Comm::Protocol::FsBroker::Params::RenameReq::to
std::string to
Definition:
Rename.h:30
SWC::Error::OK
@ OK
Definition:
Error.h:45
SWC_CURRENT_EXCEPTION
#define SWC_CURRENT_EXCEPTION(_msg_)
Definition:
Exception.h:119
SWC
The SWC-DB C++ namespace 'SWC'.
Definition:
main.cc:12
SWC::Env::FsInterface::fs
static SWC_CAN_INLINE FS::FileSystem::Ptr & fs() noexcept
Definition:
Interface.h:155
SWC::LOG_ERROR
@ LOG_ERROR
Definition:
Logger.h:32
SWC::Comm::Protocol::FsBroker::Params::RenameReq::from
std::string from
Definition:
Rename.h:29
SWC::Comm::ConnHandlerPtr
std::shared_ptr< ConnHandler > ConnHandlerPtr
Definition:
AppContext.h:17
SWC::Comm::Buffers::make
static SWC_CAN_INLINE Ptr make(uint32_t reserve=0)
Definition:
Buffers.h:27
SWC::Comm::Protocol::FsBroker::Handler::rename
void rename(const ConnHandlerPtr &conn, const Event::Ptr &ev)
Definition:
Rename.h:17
SWC::Comm::Protocol::FsBroker::Params::RenameReq
Definition:
Rename.h:17
SWC::Comm::Serializable::decode
void decode(const uint8_t **bufp, size_t *remainp)
Definition:
Serializable.h:59
SWC::Comm::Event::Ptr
std::shared_ptr< Event > Ptr
Definition:
Event.h:33
SWC::Error::Exception
Definition:
Exception.h:21
Rename.h
include
swcdb
fsbroker
handlers
Rename.h
Generated on Sat Jun 3 2023 18:00:07 for SWC-DB by
1.8.20