2 # -*- coding: utf-8 -*-
5 #sys.path.insert(0, "/usr/lib/")
6 sys
.path
.insert(0, "/tmp/dnet/lib/")
7 from libelliptics_python
import *
9 from time
import time
, ctime
12 addresses
= [("localhost", 1025),
14 ("172.16.136.1", 1025),
15 ("172.16.136.1", 1026),
19 for addr
in addresses
:
21 n
.add_remote(addr
[0], addr
[1])
26 if failed
== len(addresses
):
27 raise NameError("Can not add remote nodes")
29 def write(n
, id, aflags
, groups
):
33 n
.write_data(id, "time: " + ctime(time()), remote_offset
, aflags
, ioflags
)
34 n
.write_metadata(id, "remote id", groups
, aflags
)
39 log
= elliptics_log_file("/dev/stderr", 8)
40 n
= elliptics_node_python(log
)
47 id = elliptics_id([1, 2, 3, 4], 3, 0)
49 aflags
= 16 # no locks
51 write(n
, id, aflags
, groups
)
52 ret
= n
.prepare_latest(id, aflags
, groups
)
54 print "Groups returned:", ret
56 except Exception as e
:
59 if __name__
== "__main__":