1 | <?php |
||
15 | class LevelDB{ |
||
16 | |||
17 | /** |
||
18 | * @param string $name Path to database |
||
19 | * @param array $options |
||
20 | * @param array $read_options |
||
21 | * @param array $write_options |
||
22 | */ |
||
23 | public function __construct($name, array $options = [ |
||
24 | 'create_if_missing' => true, // if the specified database does not exist will create a new one |
||
25 | 'error_if_exists' => false, // if the opened database exists will throw exception |
||
26 | 'paranoid_checks' => false, |
||
27 | 'block_cache_size' => 8 * (2 << 20), |
||
28 | 'write_buffer_size' => 4<<20, |
||
29 | 'block_size' => 4096, |
||
30 | 'max_open_files' => 1000, |
||
31 | 'block_restart_interval' => 16, |
||
32 | 'compression' => LEVELDB_SNAPPY_COMPRESSION, |
||
33 | 'comparator' => NULL, // any callable parameter return 0, -1, 1 |
||
34 | ], array $read_options = [ |
||
35 | 'verify_check_sum' => false, //may be set to true to force checksum verification of all data that is read from the file system on behalf of a particular read. By default, no such verification is done. |
||
36 | 'fill_cache' => true, //When performing a bulk read, the application may set this to false to disable the caching so that the data processed by the bulk read does not end up displacing most of the cached contents. |
||
37 | ], array $write_options = [ |
||
38 | //Only one element named sync in the write option array. By default, each write to leveldb is asynchronous. |
||
39 | 'sync' => false |
||
40 | ]){} |
||
41 | |||
42 | /** |
||
43 | * @param string $key |
||
44 | * @param array $read_options |
||
45 | * |
||
46 | * @return string|bool |
||
47 | */ |
||
48 | public function get($key, array $read_options = []){} |
||
49 | |||
50 | /** |
||
51 | * Alias of LevelDB::put() |
||
52 | * |
||
53 | * @param string $key |
||
54 | * @param string $value |
||
55 | * @param array $write_options |
||
56 | */ |
||
57 | public function set($key, $value, array $write_options = []){} |
||
58 | |||
59 | /** |
||
60 | * @param string $key |
||
61 | * @param string $value |
||
62 | * @param array $write_options |
||
63 | */ |
||
64 | public function put($key, $value, array $write_options = []){} |
||
65 | |||
66 | /** |
||
67 | * @param string $key |
||
68 | * @param array $write_options |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | public function delete($key, array $write_options = []){} |
||
73 | |||
74 | /** |
||
75 | * Executes all of the operations added in the write batch. |
||
76 | * |
||
77 | * @param LevelDBWriteBatch $batch |
||
78 | * @param array $write_options |
||
79 | */ |
||
80 | public function write(LevelDBWriteBatch $batch, array $write_options = []){} |
||
81 | |||
82 | /** |
||
83 | * Valid properties: |
||
84 | * - leveldb.stats: returns the status of the entire db |
||
85 | * - leveldb.num-files-at-level: returns the number of files for each level. For example, you can use leveldb.num-files-at-level0 the number of files for zero level. |
||
86 | * - leveldb.sstables: returns current status of sstables |
||
87 | * |
||
88 | * @param string $name |
||
89 | * |
||
90 | * @return mixed |
||
91 | */ |
||
92 | public function getProperty($name){} |
||
93 | |||
94 | public function getApproximateSizes($start, $limit){} |
||
95 | |||
96 | public function compactRange($start, $limit){} |
||
97 | |||
98 | public function close(){} |
||
99 | |||
100 | /** |
||
101 | * @param array $options |
||
102 | * |
||
103 | * @return LevelDBIterator |
||
104 | */ |
||
105 | public function getIterator(array $options = []){} |
||
106 | |||
107 | /** |
||
108 | * @return LevelDBSnapshot |
||
109 | */ |
||
110 | public function getSnapshot(){} |
||
111 | |||
112 | static public function destroy($name, array $options = []){} |
||
113 | |||
114 | static public function repair($name, array $options = []){} |
||
115 | } |
||
116 | |||
165 |