forked from bcosorg/bcos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileServerManagerContract.cpp
76 lines (55 loc) · 1.39 KB
/
FileServerManagerContract.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "FileServerManagerContract.h"
using namespace dev;
using namespace contract;
FileServerManagerContract::FileServerManagerContract(dev::eth::Client* client, const dev::Address& contractAddr) : BaseContract(client, dev::Address(contractAddr))
{
}
FileServerManagerContract::~FileServerManagerContract()
{
}
//从FileInfoManager合约获取所有文件服务器信息json结果
int FileServerManagerContract::listFileServer(std::string& ret)
{
reset();
this->setFunction("listAll()");
const bytes& response = this->call();
ret = eth::abiOut<std::string>(response);
if (ret.empty())
{
return -1;
}
return 0;
}
/**
*@desc 查询指定文件服务器信息
*/
int FileServerManagerContract::findServerInfo(const std::string& serverid, std::string& ret)
{
reset();
this->setFunction("find(string)");
this->addParam(serverid);
const bytes& response = this->call();
ret = eth::abiOut<std::string>(response);
if (ret.empty())
{
return -1;
}
return 0;
}
/**
*@desc 查询服务节点是否开启
*/
int FileServerManagerContract::isServerEnable(const std::string& serverid, bool& enable)
{
reset();
enable = false;
this->setFunction("isServerEnable(string)");
this->addParam(serverid);
int result = 0;
if (0 != this->call(result))
{
return -1;
}
enable = result != 0 ? true : false;
return 0;
}