Difference between revisions of "Small Kyoto Cabinet and Kyoto Tycoon Notes"

From PaskvilWiki
Jump to: navigation, search
Line 20: Line 20:
 
make install
 
make install
 
</pre>
 
</pre>
 +
 +
== RPC API Interface ==
 +
 +
Further on:
 +
<pre>- short description
 +
> input parameter, required
 +
> + input parameter, optional
 +
< output parameter
 +
< + output parameter, might be omitted if not set</pre>
 +
 +
All calls accept optional <tt>DB</tt> parameter (int) that identifies DB to use.
 +
 +
<pre> get
 +
=====
 +
- retrieve value of a record
 +
> key
 +
< value
 +
< + xt - absolute expiration time
 +
 +
get_bulk
 +
==========
 +
- retrieve multiple records at once
 +
> + atomic - if present, attempt to store the records atomically
 +
> + [input] - arbitrary keys which trail the character '_'
 +
< num - number of retrieved records
 +
< + [output] - data with keys trailing the character '_'
 +
 +
check
 +
=======
 +
- checks whether record exists in DB
 +
> key
 +
< + vsiz - size of the record's value
 +
< + xt
 +
 +
set
 +
=====
 +
- set value of record
 +
> key
 +
> value
 +
> + xt - expiration time as offset in seconds; if negative, the absolute value is epoch time
 +
 +
set_bulk
 +
==========
 +
- store multiple records at once
 +
> + xt
 +
> + atomic - if present, attempt to store the records atomically
 +
> + [input] - arbitrary records whose keys trail the character '_'
 +
< num - number of stored records
 +
 +
add
 +
=====
 +
- add a record only if it does not exist
 +
> key
 +
> value
 +
> + xt
 +
 +
replace
 +
=========
 +
- replace value of a record
 +
> key
 +
> value
 +
> + xt
 +
 +
append
 +
========
 +
- append value to a record
 +
> key
 +
> value
 +
> + xt
 +
 +
increment
 +
===========
 +
- add int value to a record (treated as int)
 +
> key
 +
> num - the number to add
 +
> + orig - origin number, 0 if omitted, 'try' for INT64MIN, 'set' for INT64MAX
 +
> + xt
 +
< num - resulting value
 +
 +
increment_double
 +
==================
 +
- add double value to a record (treated as double)
 +
> key
 +
> num
 +
> + orig - origin number, 0 if omitted, 'try' for negative infinity, 'set' for positive infinity
 +
> + xt
 +
 +
cas
 +
=====
 +
- compare and swap (i.e. set the value of record to new value only if it still has the old value)
 +
> key
 +
> + oval - old value; if omitted, no record is meant
 +
> + nval - new value; if omitted, the record is removed
 +
> + xt
 +
 +
seize
 +
=======
 +
- retrieve value of a record and remove it atomically
 +
> key
 +
< + value
 +
< + xt
 +
 +
remove
 +
========
 +
- remove a record
 +
> key
 +
 +
remove_bulk
 +
=============
 +
- remove multiple records at once
 +
> + atomic - if present, attempt to store the records atomically
 +
> + [input] - arbitrary records whose keys trail the character '_'
 +
< num - number of removed records
 +
 +
clear
 +
==========
 +
- remove all records in DB

Revision as of 15:58, 15 January 2013

Kyoto Cabinet

Kyoto Cabinet at FAL Labs

./configure --prefix=/home/user
make -j4
make check
make install

Kyoto Tycoon

Kyoto Tycoon at FAL Labs

./configure --prefix=/home/user --with-kc=/home/user --enable-static
make -j4
make check
make install

RPC API Interface

Further on:

- short description
> input parameter, required
> + input parameter, optional
< output parameter
< + output parameter, might be omitted if not set

All calls accept optional DB parameter (int) that identifies DB to use.

 get
=====
- retrieve value of a record
> key
< value
< + xt - absolute expiration time

 get_bulk
==========
- retrieve multiple records at once
> + atomic - if present, attempt to store the records atomically
> + [input] - arbitrary keys which trail the character '_'
< num - number of retrieved records
< + [output] - data with keys trailing the character '_'

 check
=======
- checks whether record exists in DB
> key
< + vsiz - size of the record's value
< + xt

 set
=====
- set value of record
> key
> value
> + xt - expiration time as offset in seconds; if negative, the absolute value is epoch time

 set_bulk
==========
- store multiple records at once
> + xt
> + atomic - if present, attempt to store the records atomically
> + [input] - arbitrary records whose keys trail the character '_'
< num - number of stored records

 add
=====
- add a record only if it does not exist
> key
> value
> + xt

 replace
=========
- replace value of a record
> key
> value
> + xt

 append
========
- append value to a record
> key
> value
> + xt

 increment
===========
- add int value to a record (treated as int)
> key
> num - the number to add
> + orig - origin number, 0 if omitted, 'try' for INT64MIN, 'set' for INT64MAX
> + xt
< num - resulting value

 increment_double
==================
- add double value to a record (treated as double)
> key
> num
> + orig - origin number, 0 if omitted, 'try' for negative infinity, 'set' for positive infinity
> + xt

 cas
=====
- compare and swap (i.e. set the value of record to new value only if it still has the old value)
> key
> + oval - old value; if omitted, no record is meant
> + nval - new value; if omitted, the record is removed
> + xt

 seize
=======
- retrieve value of a record and remove it atomically
> key
< + value
< + xt

 remove
========
- remove a record
> key

 remove_bulk
=============
- remove multiple records at once
> + atomic - if present, attempt to store the records atomically
> + [input] - arbitrary records whose keys trail the character '_'
< num - number of removed records

 clear
==========
- remove all records in DB