-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
51 lines (41 loc) · 1.58 KB
/
README
File metadata and controls
51 lines (41 loc) · 1.58 KB
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
HOWTO
How to build:
``` bash
git clone https://github.com/sonntex/tarantool-capped-expirationd.git
cd tarantool-capped-expirationd
cmake .
make
```
How to grant permissions:
``` bash
box.cfg{listen=3300}
box.schema.func.create('libcapped-expirationd.start', {language = 'C'})
box.schema.user.grant('guest', 'execute', 'function', 'libcapped-expirationd.start')
box.schema.func.create('libcapped-expirationd.kill', {language = 'C'})
box.schema.user.grant('guest', 'execute', 'function', 'libcapped-expirationd.kill')
```
How to create space:
``` bash
box.cfg{listen=3300}
fiber = require('fiber')
box.schema.space.create('tester')
box.space.tester:create_index('primary', {unique = true, parts = {1, 'unsigned'}})
box.space.tester:create_index('exp', {unique = false, parts = {3, 'unsigned'}})
box.space.tester:insert{0, '0@tarantool.io', math.floor(fiber.time()) + 60}
box.space.tester:insert{1, '1@tarantool.io', math.floor(fiber.time()) + 60}
box.space.tester:insert{2, '2@tarantool.io', math.floor(fiber.time()) + 60}
```
How to start task for non-indexed exp field:
``` bash
box.cfg{listen=3300}
net_box = require('net.box')
connection = net_box:new(3300)
connection:call('libcapped-expirationd.start', {'tester', box.space.tester.id, box.space.tester.index.primary, box.space.tester.index.primary, 3, 1024, 3600})
```
How to start task for indexed exp field:
``` bash
box.cfg{listen=3300}
net_box = require('net.box')
connection = net_box:new(3300)
connection:call('libcapped-expirationd.start', {'tester', box.space.tester.id, box.space.tester.index.primary, box.space.tester.index.exp, 3, 1024, 3600})
```