Completed
Push — v5 ( 9c84b7...e03f3a )
by Georges
02:50
created

LevelDBSnapshot::release()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 1
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * LevelDB extension stub file for code completion purposes
5
 *
6
 * WARNING: Do not include this file
7
 *
8
 */
9
10
define("LEVELDB_NO_COMPRESSION", 0);
11
12
define("LEVELDB_SNAPPY_COMPRESSION", 1);
13
14
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
117
class LevelDBIterator implements Iterator{
118
119
	public function __construct(LevelDB $db, array $read_options = []){}
120
121
	public function valid(){}
122
123
	public function rewind(){}
124
125
	public function last(){}
126
127
	public function seek($key){}
128
129
	public function next(){}
130
131
	public function prev(){}
132
133
	public function key(){}
134
135
	public function current(){}
136
137
	public function getError(){}
138
139
	public function destroy(){}
140
141
}
142
143
class LevelDBWriteBatch{
144
	public function __construct($name, array $options = [], array $read_options = [], array $write_options = []){}
145
146
	public function set($key, $value, array $write_options = []){}
147
148
	public function put($key, $value, array $write_options = []){}
149
150
	public function delete($key, array $write_options = []){}
151
152
	public function clear(){}
153
}
154
155
class LevelDBSnapshot{
156
	public function __construct(LevelDB $db){}
157
158
	public function release(){}
159
160
}
161
162
class LevelDBException extends Exception{
163
164
}
165