[DEV] add factory and tools in IDL and store list of file in the picture engine
This commit is contained in:
parent
559752a3b9
commit
26843381d7
@ -212,11 +212,17 @@ class FunctionDefinition:
|
|||||||
out += space + " */\n"
|
out += space + " */\n"
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def generate_cpp(self, space):
|
def generate_cpp(self, space, class_name="", virtual=True):
|
||||||
out = "";
|
out = "";
|
||||||
out += self.generate_doxy(space)
|
out += self.generate_doxy(space)
|
||||||
out += space + "virtual "
|
out += space
|
||||||
out += convert_type_in_cpp(self.return_type, False, False) + " " + self.name + "("
|
if self.return_type != "":
|
||||||
|
if virtual == True:
|
||||||
|
out += "virtual "
|
||||||
|
out += convert_type_in_cpp(self.return_type, False, False) + " "
|
||||||
|
else:
|
||||||
|
out += "static ememory::SharedPtr<" + class_name + "> "
|
||||||
|
out += self.name + "("
|
||||||
param_data = ""
|
param_data = ""
|
||||||
id_parameter = 0
|
id_parameter = 0
|
||||||
for elem in self.parameters:
|
for elem in self.parameters:
|
||||||
@ -229,7 +235,11 @@ class FunctionDefinition:
|
|||||||
else:
|
else:
|
||||||
param_data += elem["name"]
|
param_data += elem["name"]
|
||||||
out += param_data
|
out += param_data
|
||||||
out += ") = 0;\n"
|
out += ")"
|
||||||
|
if self.return_type != "" \
|
||||||
|
and virtual == True:
|
||||||
|
out += " = 0"
|
||||||
|
out += ";\n"
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
def generate_hpp_proxy(self, space):
|
def generate_hpp_proxy(self, space):
|
||||||
@ -292,6 +302,8 @@ class ServiceDefinition:
|
|||||||
self.authors = []
|
self.authors = []
|
||||||
self.attributes = []
|
self.attributes = []
|
||||||
self.functions = []
|
self.functions = []
|
||||||
|
self.factories = []
|
||||||
|
self.tools = []
|
||||||
self.imports = []
|
self.imports = []
|
||||||
|
|
||||||
def set_name(self, value):
|
def set_name(self, value):
|
||||||
@ -311,6 +323,14 @@ class ServiceDefinition:
|
|||||||
def add_author(self, value):
|
def add_author(self, value):
|
||||||
self.authors.append(remove_start_stop_spacer(value).replace("\"", "\\\""))
|
self.authors.append(remove_start_stop_spacer(value).replace("\"", "\\\""))
|
||||||
|
|
||||||
|
def add_factory(self, value):
|
||||||
|
# TODO : Check if function already exist
|
||||||
|
self.factories.append(value)
|
||||||
|
|
||||||
|
def add_tool(self, value):
|
||||||
|
# TODO : Check if function already exist
|
||||||
|
self.tools.append(value)
|
||||||
|
|
||||||
def add_function(self, value):
|
def add_function(self, value):
|
||||||
# TODO : Check if function already exist
|
# TODO : Check if function already exist
|
||||||
self.functions.append(value)
|
self.functions.append(value)
|
||||||
@ -365,6 +385,7 @@ class ServiceDefinition:
|
|||||||
class_name += elem + "::"
|
class_name += elem + "::"
|
||||||
class_name += self.name[-1]
|
class_name += self.name[-1]
|
||||||
|
|
||||||
|
out += space + "class Proxy" + self.name[-1] + ";\n"
|
||||||
out += space + " /**\n"
|
out += space + " /**\n"
|
||||||
if self.brief != "":
|
if self.brief != "":
|
||||||
out += space + " * @brief " + self.brief + " \n"
|
out += space + " * @brief " + self.brief + " \n"
|
||||||
@ -379,11 +400,16 @@ class ServiceDefinition:
|
|||||||
space += " "
|
space += " "
|
||||||
out += space + "public:\n"
|
out += space + "public:\n"
|
||||||
space += " "
|
space += " "
|
||||||
|
if len(self.factories) == 0:
|
||||||
out += space + "/**\n"
|
out += space + "/**\n"
|
||||||
out += space + " * @brief Generic virtual destructor\n"
|
out += space + " * @brief generic factory, pay attention when set arguments...\n"
|
||||||
out += space + " */\n"
|
out += space + " */\n"
|
||||||
out += space + "template<typename ... ZEUS_OBJECT_CREATE>\n"
|
out += space + "template<typename ... ZEUS_OBJECT_CREATE>\n"
|
||||||
out += space + "static ememory::SharedPtr<" + class_name + "> create(ZEUS_OBJECT_CREATE ...);\n"
|
out += space + "static ememory::SharedPtr<" + class_name + "> create(ZEUS_OBJECT_CREATE ...);\n"
|
||||||
|
else:
|
||||||
|
for elem in self.factories:
|
||||||
|
out += elem.generate_cpp(space, class_name)
|
||||||
|
|
||||||
out += space + "/**\n"
|
out += space + "/**\n"
|
||||||
out += space + " * @brief Generic virtual destructor\n"
|
out += space + " * @brief Generic virtual destructor\n"
|
||||||
out += space + " */\n"
|
out += space + " */\n"
|
||||||
@ -397,6 +423,9 @@ class ServiceDefinition:
|
|||||||
|
|
||||||
space = space[:-2]
|
space = space[:-2]
|
||||||
out += space + "};\n"
|
out += space + "};\n"
|
||||||
|
# now we simply add tools provided:
|
||||||
|
for elem in self.tools:
|
||||||
|
out += elem.generate_cpp(space, virtual=False)
|
||||||
|
|
||||||
for elem in self.name[:-1]:
|
for elem in self.name[:-1]:
|
||||||
space = space[:-1]
|
space = space[:-1]
|
||||||
@ -880,7 +909,7 @@ def tool_generate_idl(target, module, data_option):
|
|||||||
# Find a fundtion ==> parse it
|
# Find a fundtion ==> parse it
|
||||||
#debug.error("line " + str(id_line) + " Can not parse function the line dos not ended by a ')'")
|
#debug.error("line " + str(id_line) + " Can not parse function the line dos not ended by a ')'")
|
||||||
#get first part (befor '('):
|
#get first part (befor '('):
|
||||||
list_elems = line.split("(")
|
list_elems = line.replace("[tool-remote] ", "[tool-remote]").split("(")
|
||||||
if len(list_elems) <= 1:
|
if len(list_elems) <= 1:
|
||||||
debug.error("line " + str(id_line) + " function parsing error missing the '(' element")
|
debug.error("line " + str(id_line) + " function parsing error missing the '(' element")
|
||||||
fist_part = list_elems[0].replace(" ", " ").replace(" ", " ").replace(" ", " ")
|
fist_part = list_elems[0].replace(" ", " ").replace(" ", " ").replace(" ", " ")
|
||||||
@ -896,20 +925,39 @@ def tool_generate_idl(target, module, data_option):
|
|||||||
return_value = list_elems[0]
|
return_value = list_elems[0]
|
||||||
function_name = list_elems[1]
|
function_name = list_elems[1]
|
||||||
# check types:
|
# check types:
|
||||||
if validate_type(return_value) == False:
|
debug.extreme_verbose(" Parse of function done :")
|
||||||
|
current_def.set_function_name(function_name)
|
||||||
|
type_function = "normal"
|
||||||
|
if return_value[:13] == "[tool-remote]":
|
||||||
|
type_function = "tool"
|
||||||
|
current_def.set_return_type(return_value[13:])
|
||||||
|
debug.extreme_verbose(" return:" + return_value[13:])
|
||||||
|
if validate_type(return_value[13:]) == False:
|
||||||
debug.error("line " + str(id_line) + " fucntion return type unknow : '" + return_value + "' not in " + str(get_list_type()))
|
debug.error("line " + str(id_line) + " fucntion return type unknow : '" + return_value + "' not in " + str(get_list_type()))
|
||||||
|
elif return_value == "[factory]":
|
||||||
|
type_function = "factory"
|
||||||
|
if function_name != "create":
|
||||||
|
debug.error("line " + str(id_line) + " factory function name must be 'create' not '" + function_name + "'")
|
||||||
|
debug.extreme_verbose(" return: --- ")
|
||||||
|
elif validate_type(return_value) == False:
|
||||||
|
debug.error("line " + str(id_line) + " fucntion return type unknow : '" + return_value + "' not in " + str(get_list_type()))
|
||||||
|
else:
|
||||||
|
current_def.set_return_type(return_value)
|
||||||
|
debug.extreme_verbose(" return:" + return_value)
|
||||||
|
|
||||||
for elem in argument_list:
|
for elem in argument_list:
|
||||||
if validate_type(elem) == False:
|
if validate_type(elem) == False:
|
||||||
debug.error("line " + str(id_line) + " fucntion argument type unknow : '" + elem + "' not in " + str(get_list_type()))
|
debug.error("line " + str(id_line) + " fucntion argument type unknow : '" + elem + "' not in " + str(get_list_type()))
|
||||||
debug.extreme_verbose(" Parse of function done :")
|
|
||||||
debug.extreme_verbose(" return:" + return_value)
|
|
||||||
debug.extreme_verbose(" name:" + function_name)
|
debug.extreme_verbose(" name:" + function_name)
|
||||||
debug.extreme_verbose(" arguments:" + str(argument_list))
|
debug.extreme_verbose(" arguments:" + str(argument_list))
|
||||||
current_def.set_function_name(function_name)
|
|
||||||
current_def.set_return_type(return_value)
|
|
||||||
for elem in argument_list:
|
for elem in argument_list:
|
||||||
current_def.add_parameter_type(elem)
|
current_def.add_parameter_type(elem)
|
||||||
|
if type_function == "normal":
|
||||||
service_def.add_function(current_def)
|
service_def.add_function(current_def)
|
||||||
|
elif type_function == "factory":
|
||||||
|
service_def.add_factory(current_def)
|
||||||
|
else:
|
||||||
|
service_def.add_tool(current_def)
|
||||||
else:
|
else:
|
||||||
# if must be a simple element separate with a space
|
# if must be a simple element separate with a space
|
||||||
if len(line.split("(")) != 1:
|
if len(line.split("(")) != 1:
|
||||||
|
@ -145,7 +145,7 @@ int main(int _argc, const char *_argv[]) {
|
|||||||
if (true) {
|
if (true) {
|
||||||
zeus::service::ProxyPicture remoteServicePicture = client1.getService("picture");
|
zeus::service::ProxyPicture remoteServicePicture = client1.getService("picture");
|
||||||
if (remoteServicePicture.exist() == true) {
|
if (remoteServicePicture.exist() == true) {
|
||||||
#if 0
|
#if 1
|
||||||
zeus::Future<std::vector<std::string>> retCall = remoteServicePicture.getAlbums().wait();
|
zeus::Future<std::vector<std::string>> retCall = remoteServicePicture.getAlbums().wait();
|
||||||
APPL_INFO(" album list: ");
|
APPL_INFO(" album list: ");
|
||||||
for (auto &it : retCall.get()) {
|
for (auto &it : retCall.get()) {
|
||||||
@ -171,7 +171,7 @@ int main(int _argc, const char *_argv[]) {
|
|||||||
zeus::Future<ememory::SharedPtr<zeus::ObjectRemoteBase>> retListImage = remoteServicePicture.getAlbumListPicture(it3).wait();
|
zeus::Future<ememory::SharedPtr<zeus::ObjectRemoteBase>> retListImage = remoteServicePicture.getAlbumListPicture(it3).wait();
|
||||||
zeus::ProxyFile tmpFile = zeus::ObjectRemote(retListImage.get());
|
zeus::ProxyFile tmpFile = zeus::ObjectRemote(retListImage.get());
|
||||||
APPL_INFO(" mine-type: " << tmpFile.getMineType().wait().get());
|
APPL_INFO(" mine-type: " << tmpFile.getMineType().wait().get());
|
||||||
APPL_INFO(" size: " << tmpFile.size().wait().get());
|
APPL_INFO(" size: " << tmpFile.getSize().wait().get());
|
||||||
APPL_INFO(" receive in =" << int64_t(retListImage.getTransmitionTime().count()/1000)/1000.0 << " ms");
|
APPL_INFO(" receive in =" << int64_t(retListImage.getTransmitionTime().count()/1000)/1000.0 << " ms");
|
||||||
std::string tmpFileName = std::string("./out/") + it + "_" + it2 + "_" + it3 + "." + zeus::getExtention(tmpFile.getMineType().wait().get());
|
std::string tmpFileName = std::string("./out/") + it + "_" + it2 + "_" + it3 + "." + zeus::getExtention(tmpFile.getMineType().wait().get());
|
||||||
APPL_INFO(" store in: " << tmpFileName);
|
APPL_INFO(" store in: " << tmpFileName);
|
||||||
@ -190,7 +190,9 @@ int main(int _argc, const char *_argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
echrono::Steady start = echrono::Steady::now();
|
echrono::Steady start = echrono::Steady::now();
|
||||||
ememory::SharedPtr<zeus::File> tmp = zeus::File::create("./tmpResult.bmp");
|
//ememory::SharedPtr<zeus::File> tmp = zeus::File::create("./tmpResult.bmp");
|
||||||
|
ememory::SharedPtr<zeus::File> tmp = zeus::File::create("./testImage.png");
|
||||||
|
//ememory::SharedPtr<zeus::File> tmp = zeus::File::create("./test_log.txt");
|
||||||
int32_t size = tmp->getSize();
|
int32_t size = tmp->getSize();
|
||||||
auto retSendImage = remoteServicePicture.addFile(tmp).wait();
|
auto retSendImage = remoteServicePicture.addFile(tmp).wait();
|
||||||
echrono::Steady stop = echrono::Steady::now();
|
echrono::Steady stop = echrono::Steady::now();
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
typedef bool (*SERVICE_IO_init_t)(int _argc, const char *_argv[], std::string _basePath);
|
typedef bool (*SERVICE_IO_init_t)(int _argc, const char *_argv[], std::string _basePath);
|
||||||
typedef bool (*SERVICE_IO_uninit_t)();
|
typedef bool (*SERVICE_IO_uninit_t)();
|
||||||
|
typedef void (*SERVICE_IO_peridic_call_t)();
|
||||||
typedef zeus::Object* (*SERVICE_IO_instanciate_t)(uint32_t, ememory::SharedPtr<zeus::WebServer>&, uint32_t);
|
typedef zeus::Object* (*SERVICE_IO_instanciate_t)(uint32_t, ememory::SharedPtr<zeus::WebServer>&, uint32_t);
|
||||||
|
|
||||||
class PlugginAccess {
|
class PlugginAccess {
|
||||||
@ -29,6 +30,7 @@ class PlugginAccess {
|
|||||||
void* m_handle;
|
void* m_handle;
|
||||||
SERVICE_IO_init_t m_SERVICE_IO_init;
|
SERVICE_IO_init_t m_SERVICE_IO_init;
|
||||||
SERVICE_IO_uninit_t m_SERVICE_IO_uninit;
|
SERVICE_IO_uninit_t m_SERVICE_IO_uninit;
|
||||||
|
SERVICE_IO_peridic_call_t m_SERVICE_IO_peridic_call;
|
||||||
SERVICE_IO_instanciate_t m_SERVICE_IO_instanciate;
|
SERVICE_IO_instanciate_t m_SERVICE_IO_instanciate;
|
||||||
zeus::Client m_client;
|
zeus::Client m_client;
|
||||||
public:
|
public:
|
||||||
@ -58,6 +60,12 @@ class PlugginAccess {
|
|||||||
m_SERVICE_IO_uninit = nullptr;
|
m_SERVICE_IO_uninit = nullptr;
|
||||||
APPL_WARNING("Can not function SERVICE_IO_uninit :" << error);
|
APPL_WARNING("Can not function SERVICE_IO_uninit :" << error);
|
||||||
}
|
}
|
||||||
|
m_SERVICE_IO_peridic_call = (SERVICE_IO_peridic_call_t)dlsym(m_handle, "SERVICE_IO_peridic_call");
|
||||||
|
error = dlerror();
|
||||||
|
if (error != nullptr) {
|
||||||
|
m_SERVICE_IO_uninit = nullptr;
|
||||||
|
APPL_WARNING("Can not function SERVICE_IO_uninit :" << error);
|
||||||
|
}
|
||||||
m_SERVICE_IO_instanciate = (SERVICE_IO_instanciate_t)dlsym(m_handle, "SERVICE_IO_instanciate");
|
m_SERVICE_IO_instanciate = (SERVICE_IO_instanciate_t)dlsym(m_handle, "SERVICE_IO_instanciate");
|
||||||
error = dlerror();
|
error = dlerror();
|
||||||
if (error != nullptr) {
|
if (error != nullptr) {
|
||||||
@ -98,6 +106,12 @@ class PlugginAccess {
|
|||||||
}
|
}
|
||||||
return (*m_SERVICE_IO_uninit)();
|
return (*m_SERVICE_IO_uninit)();
|
||||||
}
|
}
|
||||||
|
void peridic_call() {
|
||||||
|
if (m_SERVICE_IO_peridic_call == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
(*m_SERVICE_IO_peridic_call)();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -157,6 +171,9 @@ int main(int _argc, const char *_argv[]) {
|
|||||||
m_client.pingIsAlive();
|
m_client.pingIsAlive();
|
||||||
m_client.displayConnectedObject();
|
m_client.displayConnectedObject();
|
||||||
m_client.cleanDeadObject();
|
m_client.cleanDeadObject();
|
||||||
|
for (auto &it: listElements) {
|
||||||
|
it->peridic_call();
|
||||||
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
APPL_INFO("service in waiting ... " << iii << "/inf");
|
APPL_INFO("service in waiting ... " << iii << "/inf");
|
||||||
iii++;
|
iii++;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <zeus/File.hpp>
|
#include <zeus/File.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <zeus/zeus.hpp>
|
#include <zeus/zeus.hpp>
|
||||||
|
#include <echrono/Time.hpp>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <ejson/ejson.hpp>
|
#include <ejson/ejson.hpp>
|
||||||
@ -16,7 +17,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <etk/stdTools.hpp>
|
#include <etk/stdTools.hpp>
|
||||||
#include <algue/sha512.hpp>
|
|
||||||
|
|
||||||
#include <zeus/service/Picture.hpp>
|
#include <zeus/service/Picture.hpp>
|
||||||
#include <zeus/service/registerPicture.hpp>
|
#include <zeus/service/registerPicture.hpp>
|
||||||
@ -28,8 +28,17 @@ static std::mutex g_mutex;
|
|||||||
static std::string g_basePath;
|
static std::string g_basePath;
|
||||||
static std::string g_baseDBName = std::string(SERVICE_NAME) + "-database.json";
|
static std::string g_baseDBName = std::string(SERVICE_NAME) + "-database.json";
|
||||||
static ejson::Document g_database;
|
static ejson::Document g_database;
|
||||||
static std::map<uint64_t,std::string> m_listFile;
|
class FileProperty {
|
||||||
|
public:
|
||||||
|
std::string m_fileName; // Sha 512
|
||||||
|
std::string m_name;
|
||||||
|
std::string m_mineType;
|
||||||
|
echrono::Time m_creationData;
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::vector<FileProperty> m_listFile;
|
||||||
static uint64_t m_lastMaxId = 0;
|
static uint64_t m_lastMaxId = 0;
|
||||||
|
static bool g_needToStore = false;
|
||||||
|
|
||||||
static uint64_t createFileID() {
|
static uint64_t createFileID() {
|
||||||
m_lastMaxId++;
|
m_lastMaxId++;
|
||||||
@ -51,10 +60,10 @@ namespace appl {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
PictureService(uint16_t _clientId) {
|
PictureService(uint16_t _clientId) {
|
||||||
APPL_WARNING("New PictureService ... for user: " << _clientId);
|
APPL_VERBOSE("New PictureService ... for user: " << _clientId);
|
||||||
}
|
}
|
||||||
~PictureService() {
|
~PictureService() {
|
||||||
APPL_WARNING("delete PictureService ...");
|
APPL_VERBOSE("delete PictureService ...");
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
std::vector<std::string> getAlbums() {
|
std::vector<std::string> getAlbums() {
|
||||||
@ -168,78 +177,82 @@ namespace appl {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
// Return a File Data (might be a picture .tiff/.png/.jpg)
|
// Return a File Data (might be a picture .tiff/.png/.jpg)
|
||||||
ememory::SharedPtr<zeus::File> getAlbumPicture(std::string _pictureName) {
|
ememory::SharedPtr<zeus::File> getAlbumPicture(std::string _mediaName) {
|
||||||
std::unique_lock<std::mutex> lock(g_mutex);
|
std::unique_lock<std::mutex> lock(g_mutex);
|
||||||
// TODO : Check right ...
|
// TODO : Check right ...
|
||||||
uint64_t id = etk::string_to_uint64_t(_pictureName);
|
//Check if the file exist:
|
||||||
APPL_WARNING("try to get file : " << _pictureName << " with id=" << id);
|
bool find = false;
|
||||||
|
FileProperty property;
|
||||||
|
for (auto &it : m_listFile) {
|
||||||
|
if (it.m_fileName == _mediaName) {
|
||||||
|
find = true;
|
||||||
|
property = it;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (find == false) {
|
||||||
|
throw std::invalid_argument("Wrong file name ...");
|
||||||
|
}
|
||||||
|
return zeus::File::create(g_basePath + property.m_fileName + "." + zeus::getExtention(property.m_mineType), "", property.m_mineType);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//uint64_t id = etk::string_to_uint64_t(_pictureName);
|
||||||
|
//APPL_WARNING("try to get file : " << _pictureName << " with id=" << id);
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
auto it = m_listFile.find(id);
|
auto it = m_listFile.find(id);
|
||||||
if (it != m_listFile.end()) {
|
if (it != m_listFile.end()) {
|
||||||
return zeus::File::create(g_basePath + it->second);
|
return zeus::File::create(g_basePath + it->second);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
for (auto &it : m_listFile) {
|
for (auto &it : m_listFile) {
|
||||||
APPL_WARNING("compare: " << it.first << " with " << id << " " << it.second);
|
APPL_WARNING("compare: " << it.first << " with " << id << " " << it.second);
|
||||||
if (it.first == id) {
|
if (it.first == id) {
|
||||||
return zeus::File::create(g_basePath + it.second);
|
return zeus::File::create(g_basePath + it.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
APPL_ERROR(" ==> Not find ...");
|
APPL_ERROR(" ==> Not find ...");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
std::string addFile(zeus::ProxyFile _dataFile) {
|
std::string addFile(zeus::ProxyFile _dataFile) {
|
||||||
std::unique_lock<std::mutex> lock(g_mutex);
|
std::unique_lock<std::mutex> lock(g_mutex);
|
||||||
APPL_ERROR("Call add file ... ");
|
|
||||||
// TODO : Check right ...
|
// TODO : Check right ...
|
||||||
uint64_t id = createFileID();
|
uint64_t id = createFileID();
|
||||||
APPL_ERROR("New ID : " << id);
|
|
||||||
auto futType = _dataFile.getMineType();
|
auto futType = _dataFile.getMineType();
|
||||||
auto futName = _dataFile.getName();
|
auto futName = _dataFile.getName();
|
||||||
auto futSize = _dataFile.getSize();
|
std::string tmpFileName = g_basePath + "tmpImport_" + etk::to_string(id);
|
||||||
|
std::string sha512String = zeus::storeInFile(_dataFile, tmpFileName);
|
||||||
futType.wait();
|
futType.wait();
|
||||||
APPL_ERROR("mine-type : " << futType.get());
|
|
||||||
futName.wait();
|
futName.wait();
|
||||||
APPL_ERROR("name : " << futName.get());
|
// TODO : Get internal data of the file and remove all the meta-data ==> proper files ...
|
||||||
futSize.wait();
|
for (auto &it : m_listFile) {
|
||||||
APPL_ERROR("size : " << futSize.get());
|
if (it.m_fileName == sha512String) {
|
||||||
int64_t retSize = futSize.get();
|
APPL_INFO("File already registered at " << it.m_creationData);
|
||||||
int64_t offset = 0;
|
// TODO : Check if data is identical ...
|
||||||
algue::Sha512 shaCtx;
|
// remove temporary file
|
||||||
etk::FSNode nodeFile(g_basePath + "tmpImport_" + etk::to_string(id));
|
etk::FSNodeRemove(tmpFileName);
|
||||||
nodeFile.fileOpenWrite();
|
return sha512String;
|
||||||
while (retSize > 0) {
|
|
||||||
int32_t nbElement = 1*1024*1024;
|
|
||||||
if (retSize<nbElement) {
|
|
||||||
nbElement = retSize;
|
|
||||||
}
|
}
|
||||||
auto futData = _dataFile.getPart(offset, offset + nbElement);
|
|
||||||
futData.wait();
|
|
||||||
if (futData.hasError() == true) {
|
|
||||||
throw std::runtime_error("ErrorWhen loading data");
|
|
||||||
}
|
}
|
||||||
zeus::Raw buffer = futData.get();
|
// move the file at the good position:
|
||||||
APPL_ERROR(" get size ... : " << buffer.size() << " " << nbElement);
|
APPL_ERROR("move temporay file in : " << g_basePath << sha512String);
|
||||||
shaCtx.update(buffer.data(), buffer.size());
|
etk::FSNodeMove(tmpFileName, g_basePath + sha512String + "." + zeus::getExtention(futType.get()));
|
||||||
nodeFile.fileWrite(buffer.data(), 1, buffer.size());
|
FileProperty property;
|
||||||
offset += nbElement;
|
property.m_fileName = sha512String;
|
||||||
retSize -= nbElement;
|
property.m_name = futName.get();
|
||||||
}
|
property.m_mineType = futType.get();
|
||||||
std::string sha256String = algue::stringConvert(shaCtx.finalize());
|
property.m_creationData = echrono::Time::now();
|
||||||
APPL_ERROR(" filename : " << sha256String);
|
APPL_ERROR("Current Time : " << echrono::Time::now());
|
||||||
return sha256String;
|
m_listFile.push_back(property);
|
||||||
|
g_needToStore = true;
|
||||||
/*
|
APPL_ERROR(" filename : " << sha512String);
|
||||||
APPL_ERROR(" ==> Receive FILE " << _dataFile.getMineType() << " size=" << _dataFile.getData().size());
|
return sha512String;
|
||||||
std::stringstream val;
|
|
||||||
val << std::hex << std::setw(16) << std::setfill('0') << id;
|
|
||||||
std::string filename = val.str();
|
|
||||||
filename += ".";
|
|
||||||
filename += zeus::getExtention(_dataFile.getMineType());
|
|
||||||
_dataFile.storeIn(g_basePath + filename);
|
|
||||||
m_listFile.insert(std::make_pair(id, filename));
|
|
||||||
*/
|
|
||||||
return etk::to_string(id);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// Return a global UTC time
|
// Return a global UTC time
|
||||||
@ -304,14 +317,58 @@ namespace appl {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void store_db() {
|
||||||
|
APPL_ERROR("Store database [START]");
|
||||||
|
ejson::Document database;
|
||||||
|
ejson::Array listFilesArray;
|
||||||
|
database.add("list-files", listFilesArray);
|
||||||
|
for (auto &it : m_listFile) {
|
||||||
|
ejson::Object fileElement;
|
||||||
|
fileElement.add("file-name", ejson::String(it.m_fileName));
|
||||||
|
fileElement.add("name", ejson::String(it.m_name));
|
||||||
|
fileElement.add("mine-type", ejson::String(it.m_mineType));
|
||||||
|
fileElement.add("add-date", ejson::Number(it.m_creationData.count()));
|
||||||
|
listFilesArray.add(fileElement);
|
||||||
|
}
|
||||||
|
bool retGenerate = database.storeSafe(g_basePath + g_baseDBName);
|
||||||
|
APPL_ERROR("Store database [STOP] : " << (g_basePath + g_baseDBName) << " ret = " << retGenerate);
|
||||||
|
g_needToStore = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void load_db() {
|
||||||
|
ejson::Document database;
|
||||||
|
bool ret = database.load(g_basePath + g_baseDBName);
|
||||||
|
if (ret == false) {
|
||||||
|
APPL_WARNING(" ==> LOAD error");
|
||||||
|
}
|
||||||
|
ejson::Array listFilesArray = database["list-files"].toArray();
|
||||||
|
for (const auto itArray: listFilesArray) {
|
||||||
|
ejson::Object fileElement = itArray.toObject();
|
||||||
|
FileProperty property;
|
||||||
|
|
||||||
|
property.m_fileName = fileElement["file-name"].toString().get();
|
||||||
|
property.m_name = fileElement["name"].toString().get();
|
||||||
|
property.m_mineType = fileElement["mine-type"].toString().get();
|
||||||
|
property.m_creationData = echrono::Time(fileElement["add-date"].toNumber().getU64()*1000);
|
||||||
|
|
||||||
|
if (property.m_fileName == "") {
|
||||||
|
APPL_ERROR("Can not access on the file : ... No name ");
|
||||||
|
} else {
|
||||||
|
m_listFile.push_back(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_needToStore = false;
|
||||||
|
}
|
||||||
|
|
||||||
ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], std::string _basePath) {
|
ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], std::string _basePath) {
|
||||||
g_basePath = _basePath;
|
g_basePath = _basePath;
|
||||||
std::unique_lock<std::mutex> lock(g_mutex);
|
std::unique_lock<std::mutex> lock(g_mutex);
|
||||||
APPL_WARNING("Load USER: " << g_basePath);
|
APPL_WARNING("Load USER: " << g_basePath);
|
||||||
bool ret = g_database.load(g_basePath + g_baseDBName);
|
load_db();
|
||||||
if (ret == false) {
|
|
||||||
APPL_WARNING(" ==> LOAD error");
|
/*
|
||||||
}
|
|
||||||
|
|
||||||
// Load all files (image and video ...)
|
// Load all files (image and video ...)
|
||||||
etk::FSNode node(g_basePath);
|
etk::FSNode node(g_basePath);
|
||||||
std::vector<etk::FSNode*> tmpList = node.folderGetSubList(false, false, true, false);
|
std::vector<etk::FSNode*> tmpList = node.folderGetSubList(false, false, true, false);
|
||||||
@ -339,7 +396,7 @@ ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], std::string
|
|||||||
if (id <= 1024) {
|
if (id <= 1024) {
|
||||||
APPL_WARNING(" ==> REJECTED file " << it->getNameFile() << " with ID = " << id);
|
APPL_WARNING(" ==> REJECTED file " << it->getNameFile() << " with ID = " << id);
|
||||||
} else {
|
} else {
|
||||||
m_listFile.insert(std::make_pair(id, it->getNameFile()));
|
//m_listFile.insert(std::make_pair(id, it->getNameFile()));
|
||||||
m_lastMaxId = std::max(m_lastMaxId,id);
|
m_lastMaxId = std::max(m_lastMaxId,id);
|
||||||
APPL_WARNING(" ==> load file " << it->getNameFile() << " with ID = " << id);
|
APPL_WARNING(" ==> load file " << it->getNameFile() << " with ID = " << id);
|
||||||
}
|
}
|
||||||
@ -347,22 +404,30 @@ ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], std::string
|
|||||||
APPL_WARNING(" ==> REJECT file " << it->getNameFile());
|
APPL_WARNING(" ==> REJECT file " << it->getNameFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
APPL_WARNING("new USER: [STOP]");
|
APPL_WARNING("new USER: [STOP]");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ETK_EXPORT_API bool SERVICE_IO_uninit() {
|
ETK_EXPORT_API bool SERVICE_IO_uninit() {
|
||||||
std::unique_lock<std::mutex> lock(g_mutex);
|
std::unique_lock<std::mutex> lock(g_mutex);
|
||||||
APPL_DEBUG("Store User Info:");
|
store_db();
|
||||||
bool ret = g_database.storeSafe(g_basePath + g_baseDBName);
|
|
||||||
if (ret == false) {
|
|
||||||
APPL_WARNING(" ==> Store error");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
APPL_WARNING("delete USER [STOP]");
|
APPL_WARNING("delete USER [STOP]");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ETK_EXPORT_API void SERVICE_IO_peridic_call() {
|
||||||
|
if (g_needToStore == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// try lock mutex:
|
||||||
|
if (g_mutex.try_lock() == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store_db();
|
||||||
|
g_mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ZEUS_SERVICE_PICTURE_DECLARE(appl::PictureService);
|
ZEUS_SERVICE_PICTURE_DECLARE(appl::PictureService);
|
||||||
|
|
||||||
|
@ -20,14 +20,13 @@ zeus::Raw::Raw(uint32_t _size) :
|
|||||||
m_dataExternal(nullptr),
|
m_dataExternal(nullptr),
|
||||||
m_dataInternal() {
|
m_dataInternal() {
|
||||||
m_dataInternal.resize(_size);
|
m_dataInternal.resize(_size);
|
||||||
ZEUS_ERROR("Create BUFFER 1 : " << m_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::Raw::Raw(uint32_t _size, const uint8_t* _data) :
|
zeus::Raw::Raw(uint32_t _size, const uint8_t* _data) :
|
||||||
m_size(_size),
|
m_size(_size),
|
||||||
m_dataExternal(_data),
|
m_dataExternal(_data),
|
||||||
m_dataInternal() {
|
m_dataInternal() {
|
||||||
ZEUS_ERROR("Create BUFFER 2 : " << m_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::Raw::~Raw() {
|
zeus::Raw::~Raw() {
|
||||||
|
@ -35,9 +35,9 @@ void zeus::WebObj::receive(ememory::SharedPtr<zeus::Message> _value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void zeus::WebObj::display() {
|
void zeus::WebObj::display() {
|
||||||
ZEUS_INFO(" - [" << m_id << "/" << m_objectId << "]");
|
ZEUS_DEBUG(" - [" << m_id << "/" << m_objectId << "]");
|
||||||
for (auto &it : m_listRemoteConnected) {
|
for (auto &it : m_listRemoteConnected) {
|
||||||
ZEUS_INFO(" * [" << (it>>16) << "/" << (it&0xFFFF) << "]");
|
ZEUS_DEBUG(" * [" << (it>>16) << "/" << (it&0xFFFF) << "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +235,8 @@ class SendAsyncBinary {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ZEUS_LOG_INPUT_OUTPUT ZEUS_WARNING
|
//#define ZEUS_LOG_INPUT_OUTPUT ZEUS_WARNING
|
||||||
//#define ZEUS_LOG_INPUT_OUTPUT ZEUS_VERBOSE
|
#define ZEUS_LOG_INPUT_OUTPUT ZEUS_VERBOSE
|
||||||
|
|
||||||
|
|
||||||
int32_t zeus::WebServer::writeBinary(ememory::SharedPtr<zeus::Message> _obj) {
|
int32_t zeus::WebServer::writeBinary(ememory::SharedPtr<zeus::Message> _obj) {
|
||||||
@ -427,7 +427,7 @@ void zeus::WebServer::newMessage(ememory::SharedPtr<zeus::Message> _buffer) {
|
|||||||
m_processingPool.async(
|
m_processingPool.async(
|
||||||
[=](){
|
[=](){
|
||||||
zeus::FutureBase fut = future;
|
zeus::FutureBase fut = future;
|
||||||
ZEUS_INFO("PROCESS FUTURE : " << _buffer);
|
ZEUS_LOG_INPUT_OUTPUT("PROCESS FUTURE : " << _buffer);
|
||||||
// add data ...
|
// add data ...
|
||||||
bool ret = fut.setMessage(_buffer);
|
bool ret = fut.setMessage(_buffer);
|
||||||
if (ret == true) {
|
if (ret == true) {
|
||||||
@ -456,7 +456,7 @@ void zeus::WebServer::listObjects() {
|
|||||||
&& m_listRemoteObject.size() == 0) {
|
&& m_listRemoteObject.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ZEUS_INFO("[" << m_interfaceId << "] Interface WebServer:");
|
ZEUS_DEBUG("[" << m_interfaceId << "] Interface WebServer:");
|
||||||
for (auto &it : m_listObject) {
|
for (auto &it : m_listObject) {
|
||||||
if (it == nullptr) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1443,14 +1443,7 @@ namespace zeus {
|
|||||||
uint32_t dataSize = getParameterSize(_id);
|
uint32_t dataSize = getParameterSize(_id);
|
||||||
// TODO : Check size ...
|
// TODO : Check size ...
|
||||||
if (createType<zeus::Raw>() == type) {
|
if (createType<zeus::Raw>() == type) {
|
||||||
// get size if the file in int32_t
|
return zeus::Raw(dataSize, pointer);
|
||||||
#if 0
|
|
||||||
uint32_t size = 0;
|
|
||||||
memcpy(&size, pointer, sizeof(uint32_t));
|
|
||||||
#else
|
|
||||||
uint32_t size = dataSize;
|
|
||||||
#endif
|
|
||||||
return zeus::Raw(size, &pointer[sizeof(uint32_t)]);
|
|
||||||
}
|
}
|
||||||
ZEUS_ERROR("Can not get type from '" << type << "'");
|
ZEUS_ERROR("Can not get type from '" << type << "'");
|
||||||
return zeus::Raw();
|
return zeus::Raw();
|
||||||
|
@ -120,6 +120,35 @@ static std::vector<std::pair<std::string, std::string>> mineList = {
|
|||||||
{ "rgb", "image/x-raw/r8g8b8"},
|
{ "rgb", "image/x-raw/r8g8b8"},
|
||||||
{ "rgba", "image/x-raw/r8g8b8a8"},
|
{ "rgba", "image/x-raw/r8g8b8a8"},
|
||||||
|
|
||||||
|
{ "js", "application/javascript"},
|
||||||
|
{ "raw", "application/octet-stream"},
|
||||||
|
{ "ogg", "application/ogg"},
|
||||||
|
{ "pdf", "application/pdf"},
|
||||||
|
{ "xhtml", "application/xhtml+xml"},
|
||||||
|
{ "flw", "application/x-shockwave-flash"},
|
||||||
|
{ "json", "application/json"},
|
||||||
|
{ "xml", "application/xml"},
|
||||||
|
{ "zip", "application/zip"},
|
||||||
|
{ "gz", "application/gzip"},
|
||||||
|
{ "rar", "application/rar"},
|
||||||
|
|
||||||
|
{ "css", "text/css"},
|
||||||
|
{ "csv", "text/csv"},
|
||||||
|
{ "html", "text/html"},
|
||||||
|
{ "js", "text/javascript"}, // DEPRECATED application/javascript.
|
||||||
|
{ "txt", "text/plain"},
|
||||||
|
{ "xml", "text/xml"},
|
||||||
|
{ "json", "text/json"},
|
||||||
|
{ "yml", "text/yml"},
|
||||||
|
|
||||||
|
{ "c", "code/c"},
|
||||||
|
{ "h", "header/c"},
|
||||||
|
{ "cpp", "code/c++"},
|
||||||
|
{ "hpp", "header/c++"},
|
||||||
|
{ "c#", "code/c#"},
|
||||||
|
{ "py", "code/python"},
|
||||||
|
{ "java", "code/java"},
|
||||||
|
{ "js", "code/javascript"},
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string zeus::getMineType(const std::string& _extention) {
|
std::string zeus::getMineType(const std::string& _extention) {
|
||||||
|
@ -5,29 +5,37 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <zeus/zeus-File.impl.hpp>
|
#include <zeus/zeus-File.impl.hpp>
|
||||||
|
#include <zeus/ProxyFile.hpp>
|
||||||
#include <zeus/mineType.hpp>
|
#include <zeus/mineType.hpp>
|
||||||
|
#include <algue/sha512.hpp>
|
||||||
#include "debug.hpp"
|
#include "debug.hpp"
|
||||||
|
|
||||||
namespace zeus {
|
|
||||||
template<>
|
ememory::SharedPtr<zeus::File> zeus::File::create(std::string _fileNameReal) {
|
||||||
ememory::SharedPtr<zeus::File> File::create<std::string>(std::string _filename) {
|
return ememory::makeShared<zeus::FileImpl>(_fileNameReal);
|
||||||
return ememory::makeShared<zeus::FileImpl>(_filename);
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
ememory::SharedPtr<zeus::File> File::create<const char*>(const char* _filename) {
|
|
||||||
return ememory::makeShared<zeus::FileImpl>(_filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::FileImpl::FileImpl(std::string _filename) :
|
ememory::SharedPtr<zeus::File> zeus::File::create(std::string _fileNameReal, std::string _fileNameShow, std::string _mineType) {
|
||||||
m_filename(_filename),
|
return ememory::makeShared<zeus::FileImpl>(_fileNameReal, _fileNameShow, _mineType);
|
||||||
m_node(_filename) {
|
}
|
||||||
|
|
||||||
|
zeus::FileImpl::FileImpl(std::string _fileNameReal) :
|
||||||
|
m_filename(_fileNameReal),
|
||||||
|
m_node(_fileNameReal) {
|
||||||
m_size = m_node.fileSize();
|
m_size = m_node.fileSize();
|
||||||
m_node.fileOpenRead();
|
m_node.fileOpenRead();
|
||||||
std::string extention = std::string(_filename.begin()+_filename.size() -3, _filename.end());
|
std::string extention = std::string(_fileNameReal.begin()+_fileNameReal.size() -3, _fileNameReal.end());
|
||||||
m_mineType = zeus::getMineType(extention);
|
m_mineType = zeus::getMineType(extention);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zeus::FileImpl::FileImpl(std::string _fileNameReal, std::string _fileNameShow, std::string _mineType) :
|
||||||
|
m_filename(_fileNameShow),
|
||||||
|
m_node(_fileNameReal),
|
||||||
|
m_mineType(_mineType) {
|
||||||
|
m_size = m_node.fileSize();
|
||||||
|
m_node.fileOpenRead();
|
||||||
|
}
|
||||||
|
|
||||||
zeus::FileImpl::~FileImpl() {
|
zeus::FileImpl::~FileImpl() {
|
||||||
m_node.fileClose();
|
m_node.fileClose();
|
||||||
}
|
}
|
||||||
@ -61,5 +69,36 @@ zeus::Raw zeus::FileImpl::getPart(uint64_t _start, uint64_t _stop) {
|
|||||||
return std::move(tmp);
|
return std::move(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string zeus::storeInFile(zeus::ProxyFile _file, std::string _filename) {
|
||||||
|
auto futSize = _file.getSize();
|
||||||
|
futSize.wait();
|
||||||
|
int64_t retSize = futSize.get();
|
||||||
|
int64_t offset = 0;
|
||||||
|
|
||||||
|
algue::Sha512 shaCtx;
|
||||||
|
etk::FSNode nodeFile(_filename);
|
||||||
|
nodeFile.fileOpenWrite();
|
||||||
|
while (retSize > 0) {
|
||||||
|
// get by batch of 1 MB
|
||||||
|
int32_t nbElement = 1*1024*1024;
|
||||||
|
if (retSize<nbElement) {
|
||||||
|
nbElement = retSize;
|
||||||
|
}
|
||||||
|
auto futData = _file.getPart(offset, offset + nbElement);
|
||||||
|
futData.wait();
|
||||||
|
if (futData.hasError() == true) {
|
||||||
|
throw std::runtime_error("Error when loading data");
|
||||||
|
}
|
||||||
|
zeus::Raw buffer = futData.get();
|
||||||
|
shaCtx.update(buffer.data(), buffer.size());
|
||||||
|
nodeFile.fileWrite(buffer.data(), 1, buffer.size());
|
||||||
|
offset += nbElement;
|
||||||
|
retSize -= nbElement;
|
||||||
|
}
|
||||||
|
nodeFile.fileClose();
|
||||||
|
// get the final sha512 of the file:
|
||||||
|
std::string sha512String = algue::stringConvert(shaCtx.finalize());
|
||||||
|
return sha512String;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,8 @@ namespace zeus {
|
|||||||
size_t m_size;
|
size_t m_size;
|
||||||
std::string m_mineType;
|
std::string m_mineType;
|
||||||
public:
|
public:
|
||||||
FileImpl(std::string _filename);
|
FileImpl(std::string _fileNameReal, std::string _fileNameShow, std::string _mineType);
|
||||||
|
FileImpl(std::string _fileNameReal);
|
||||||
~FileImpl();
|
~FileImpl();
|
||||||
uint64_t getSize() override;
|
uint64_t getSize() override;
|
||||||
std::string getName() override;
|
std::string getName() override;
|
||||||
|
@ -3,29 +3,48 @@
|
|||||||
#elem-type:FILE
|
#elem-type:FILE
|
||||||
#elem-author:Heero Yui<yui.heero@gmail.com>
|
#elem-author:Heero Yui<yui.heero@gmail.com>
|
||||||
|
|
||||||
#param:_fileName: Name of the local file to instanciate
|
// --------------------------
|
||||||
//factory obj:zeus-File
|
// -- Factory --
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
#brief:Get size of the file
|
#brief:Factory to create a local object.
|
||||||
#return:current size of the file
|
#param:fileName:Name of the local file to instanciate.
|
||||||
|
[factory] create(string)
|
||||||
|
#brief:Factory to create a local object.
|
||||||
|
#param:fileNameReal:Name of the local file to instanciate.
|
||||||
|
#param:fileNameShow:Name of the file like the remote user will se it.
|
||||||
|
#param:mineType:Mine-type of the file.
|
||||||
|
[factory] create(string, string, string)
|
||||||
|
|
||||||
|
// --------------------------
|
||||||
|
// -- Members --
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
|
#brief:Get size of the file.
|
||||||
|
#return:current size of the file.
|
||||||
uint64 getSize()
|
uint64 getSize()
|
||||||
|
|
||||||
#brief:Get the name of the file
|
#brief:Get the name of the file.
|
||||||
#return:Full name of the file (sha512)
|
#return:Full name of the file (sha512).
|
||||||
string getName()
|
string getName()
|
||||||
|
|
||||||
#brief:Get the file "mine-type"
|
#brief:Get the file "mine-type".
|
||||||
#return:string of the mine-type
|
#return:string of the mine-type.
|
||||||
string getMineType()
|
string getMineType()
|
||||||
|
|
||||||
#brief:get a part of the file (size < 64ko)
|
#brief:get a part of the file (size < 64ko).
|
||||||
#param:_start:Start position in the file
|
#param:start:Start position in the file.
|
||||||
#param:_stop:Stop position in the file
|
#param:stop:Stop position in the file.
|
||||||
#return:Buffer with the data
|
#return:Buffer with the data.
|
||||||
raw getPart(uint64, uint64)
|
raw getPart(uint64, uint64)
|
||||||
|
|
||||||
|
// --------------------------
|
||||||
|
// -- Tools --
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
|
#brief:Store all the data in a specific file.
|
||||||
|
#param:file:Handle on the file.
|
||||||
|
#param:filename:Local filename.
|
||||||
|
#return:the sha512 of the file (calculated with the input stream.
|
||||||
|
[tool-remote] string storeInFile(obj:zeus-File, string)
|
||||||
|
|
||||||
#brief:Store all the data in a specific file
|
|
||||||
#param:_file: Handle on the file
|
|
||||||
#param:_filename:Local filename
|
|
||||||
//tool void storeInTemporaryFile(obj:zeus-File, string)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user