NodeAddress

\struct NodeAddress Struct for node addresses

Members

Functions

toString
string toString()

Parse node address to string @return string address

Manifest constants

intrn_token
enum intrn_token;
Undocumented in source.
p2p_token
enum p2p_token;
Undocumented in source.
tcp_token
enum tcp_token;
Undocumented in source.

Mixins

__anonymous
mixin HiBONRecord!(q{ this(string address) { pragma(msg, "fixme(pr): addressbook for mode0 should be created instead"); this.address = address; } this(string address, const ulong port_base, bool marshal = false) { import std.string; try { this.address = address; this.is_marshal = marshal; if (!marshal) { pragma(msg, "fixme(cbr): This code should be done with a regex"); this.id = address[address.lastIndexOf(p2p_token) + 5 .. $]; auto tcpIndex = address.indexOf(tcp_token) + tcp_token.length; this.port = to!uint(address[tcpIndex .. tcpIndex + 4]); const node_number = this.port - port_base; sector = SectorRange(0, 0); } else if (address[0..intrn_token.length] != intrn_token) { import std.json; auto json = parseJSON(address); this.id = json["ID"].str; auto addr = (() @trusted => json["Addrs"].array()[0].str())(); auto tcpIndex = addr.indexOf(tcp_token) + tcp_token.length; this.port = to!uint(addr[tcpIndex .. tcpIndex + 4]); } } catch (Exception e) { log.fatal(e.msg); } } })
Undocumented in source.

Static functions

parseAddr
string parseAddr(string addr)

Parse node address @param addr - address to parse @return parsed address

Variables

address
string address;

node address

id
string id;

node id

is_marshal
bool is_marshal;

If true, then struct with node addresses is used as an address If false, then the local address used

port
uint port;

node port

sector
SectorRange sector;

DART sector

Mixed In Members

From mixin HiBONRecord!(q{ this(string address) { pragma(msg, "fixme(pr): addressbook for mode0 should be created instead"); this.address = address; } this(string address, const ulong port_base, bool marshal = false) { import std.string; try { this.address = address; this.is_marshal = marshal; if (!marshal) { pragma(msg, "fixme(cbr): This code should be done with a regex"); this.id = address[address.lastIndexOf(p2p_token) + 5 .. $]; auto tcpIndex = address.indexOf(tcp_token) + tcp_token.length; this.port = to!uint(address[tcpIndex .. tcpIndex + 4]); const node_number = this.port - port_base; sector = SectorRange(0, 0); } else if (address[0..intrn_token.length] != intrn_token) { import std.json; auto json = parseJSON(address); this.id = json["ID"].str; auto addr = (() @trusted => json["Addrs"].array()[0].str())(); auto tcpIndex = addr.indexOf(tcp_token) + tcp_token.length; this.port = to!uint(addr[tcpIndex .. tcpIndex + 4]); } } catch (Exception e) { log.fatal(e.msg); } } })

check
alias check = Check!(HiBONRecordException)
Undocumented in source.
__anonymous
mixin JSONString
Undocumented in source.
__anonymous
mixin HiBONRecordType
Undocumented in source.
isRecord
alias isRecord = HiBONRecord.isRecord!ThisType
Undocumented in source.
HAS_TYPE
enum HAS_TYPE;
Undocumented in source.
less_than
bool less_than(Key a, Key b)
Undocumented in source. Be warned that the author may not have intended to support it.
toHiBON
inout(HiBON) toHiBON()
Undocumented in source. Be warned that the author may not have intended to support it.
NO_DEFAULT_CTOR
enum NO_DEFAULT_CTOR;
Undocumented in source.
GetKeyName
template GetKeyName(uint i)
Undocumented in source.
_keys
string[] _keys()
keys
enum keys;
Undocumented in source.
this
this(HiBON hibon)
Undocumented in source.
this
this(Document doc)
Undocumented in source.
serialize
immutable(ubyte[]) serialize()
Undocumented in source. Be warned that the author may not have intended to support it.
toDoc
const(Document) toDoc()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta