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
#!./pmemobjcli -s
# This is an example script for pmemobjcli application.
# usage: ./example_tx.posc <file>
# allocate root object with specified size
pmemobj_root 256
# allocate two zeroed objects in root object
# at positions 0 and 1
pmemobj_zalloc r.0 1 8192
pmemobj_zalloc r.1 2 256
# begin transaction with jmp_buf argument
pmemobj_tx_begin jmp
# create a snapshot of entire root object
pmemobj_tx_add_range r 0 256
# allocate an object using strdup at 4th position
# in root object
pmemobj_tx_strdup r.4 0 5
# add snaphots
pmemobj_tx_add_range_direct r.0 64 128
pmemobj_tx_add_range r.1 16 16
# allocate object transactionally
pmemobj_tx_zalloc r.3 8192 3
# reallocate object transactionally
pmemobj_tx_zrealloc r.3 2048 3
# de-allocate object transactionally
pmemobj_tx_free r.4
# print current stage
pmemobj_tx_stage
# begin transaction without jmp_buf argument
pmemobj_tx_begin
# commit current transaction
pmemobj_tx_commit
# print current stage
pmemobj_tx_stage
# move to the next stage
pmemobj_tx_process
# print current stage
pmemobj_tx_stage
# end current transaction
pmemobj_tx_end
# print current stage
pmemobj_tx_stage
# abort current transaction
pmemobj_tx_abort -1
# print current stage
pmemobj_tx_stage
# end current transaction
pmemobj_tx_end
# print current stage
pmemobj_tx_stage