2024-07-04 16:20:57 +08:00
|
|
|
package sled
|
|
|
|
|
|
|
|
|
|
import "github.com/goplus/llgo/c"
|
|
|
|
|
|
|
|
|
|
// Write the .pc file for the dylib generated by the Rust library and copy it to pkg-config for proper location.
|
|
|
|
|
const (
|
|
|
|
|
LLGoPackage = "link: $(pkg-config --libs sled); -lsled"
|
|
|
|
|
)
|
|
|
|
|
|
2024-07-09 09:39:44 +08:00
|
|
|
type Config struct {
|
2024-07-04 16:20:57 +08:00
|
|
|
Unused [8]byte
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-09 09:39:44 +08:00
|
|
|
type DB struct {
|
2024-07-04 16:20:57 +08:00
|
|
|
Unused [8]byte
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-05 17:43:33 +08:00
|
|
|
// Create a new configuration
|
|
|
|
|
// llgo:link CreateConfig C.sled_create_config
|
2024-07-09 09:39:44 +08:00
|
|
|
func CreateConfig() *Config { return nil }
|
2024-07-04 16:20:57 +08:00
|
|
|
|
2024-07-05 17:43:33 +08:00
|
|
|
// Free a configuration
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*Config).FreeConfig C.sled_free_config
|
|
|
|
|
func (conf *Config) FreeConfig() {}
|
2024-07-04 16:20:57 +08:00
|
|
|
|
2024-07-05 17:43:33 +08:00
|
|
|
// Set the configured file path
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*Config).SetPath C.sled_config_set_path
|
|
|
|
|
func (conf *Config) SetPath(path *c.Char) *Config { return nil }
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Set the configured cache capacity in bytes
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*Config).SetCacheCapacity C.sled_config_set_cache_capacity
|
|
|
|
|
func (conf *Config) SetCacheCapacity(capacity c.Ulong) *Config { return nil }
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Configure the use of the zstd compression library
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*Config).UseCompression C.sled_config_use_compression
|
|
|
|
|
func (conf *Config) UseCompression(use_compression c.Char) *Config { return nil }
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Set the configured IO buffer flush interval in milliseconds
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*Config).SetFlushEveryMs C.sled_config_flush_every_ms
|
|
|
|
|
func (conf *Config) SetFlushEveryMs(flush_every c.Int) *Config { return nil }
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Open a sled lock-free log-structured tree
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*Config).OpenDb C.sled_open_db
|
|
|
|
|
func (conf *Config) OpenDb() *DB { return nil }
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Close a sled lock-free log-structured tree
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*DB).Close C.sled_close
|
|
|
|
|
func (db *DB) Close() {}
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Free a buffer originally allocated by sled
|
|
|
|
|
// llgo:link FreeBuf C.sled_free_buf
|
|
|
|
|
func FreeBuf(buf *c.Char, sz c.Ulong) {}
|
|
|
|
|
|
|
|
|
|
// Set a key to a value
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*DB).Set C.sled_set
|
|
|
|
|
func (db *DB) Set(key *c.Char, keylen c.Ulong, val *c.Char, vallen c.Ulong) {}
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Get the value of a key
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*DB).Get C.sled_get
|
|
|
|
|
func (db *DB) Get(key *c.Char, keylen c.Ulong, vallen *c.Ulong) *c.Char { return nil }
|
2024-07-05 17:43:33 +08:00
|
|
|
|
|
|
|
|
// Delete the value of a key
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*DB).Del C.sled_del
|
|
|
|
|
func (db *DB) Del(key *c.Char, keylen c.Ulong) {}
|
2024-07-04 16:20:57 +08:00
|
|
|
|
2024-07-05 17:43:33 +08:00
|
|
|
// Compare and swap
|
2024-07-09 09:39:44 +08:00
|
|
|
// llgo:link (*DB).CompareAndSwap C.sled_compare_and_swap
|
|
|
|
|
func (db *DB) CompareAndSwap(key *c.Char, keylen c.Ulong, old_val *c.Char, old_vallen c.Ulong, new_val *c.Char, new_vallen c.Ulong, actual_val **c.Char, actual_vallen *c.Ulong) c.Char {
|
2024-07-05 17:43:33 +08:00
|
|
|
return 0
|
2024-07-04 16:20:57 +08:00
|
|
|
}
|