Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ bitcoin = "0.32.7"
bip39 = { version = "2.0.0", features = ["rand"] }
bip21 = { version = "0.5", features = ["std"], default-features = false }

async-trait = {version = "0.1.89"}
base64 = { version = "0.22.1", default-features = false, features = ["std"] }
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
chrono = { version = "0.4", default-features = false, features = ["clock"] }
Expand Down
61 changes: 61 additions & 0 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ enum WordCount {
"Words24",
};

dictionary RetryConfig {
u16 initial_retry_delay_ms;
u16 maximum_delay_secs;
f32 backoff_multiplier;
};

enum LogLevel {
"Gossip",
"Trace",
Expand All @@ -90,6 +96,56 @@ interface LogWriter {
void log(LogRecord record);
};

interface DynStore {
[Name=from_store]
constructor(SyncAndAsyncKVStore store);
};

[Trait, WithForeign]
interface SyncAndAsyncKVStore {
// KVStoreSync versions
[Throws=IOError]
sequence<u8> read_sync(string primary_namespace, string secondary_namespace, string key);
[Throws=IOError]
void write_sync(string primary_namespace, string secondary_namespace, string key, sequence<u8> buf);
[Throws=IOError]
void remove_sync(string primary_namespace, string secondary_namespace, string key, boolean lazy);
[Throws=IOError]
sequence<string> list_sync(string primary_namespace, string secondary_namespace);

// KVStore versions
[Throws=IOError, Async]
sequence<u8> read_async(string primary_namespace, string secondary_namespace, string key);
[Throws=IOError, Async]
void write_async(string primary_namespace, string secondary_namespace, string key, sequence<u8> buf);
[Throws=IOError, Async]
void remove_async(string primary_namespace, string secondary_namespace, string key, boolean lazy);
[Throws=IOError, Async]
sequence<string> list_async(string primary_namespace, string secondary_namespace);
};

[Error]
enum IOError {
"NotFound",
"PermissionDenied",
"ConnectionRefused",
"ConnectionReset",
"ConnectionAborted",
"NotConnected",
"AddrInUse",
"AddrNotAvailable",
"BrokenPipe",
"AlreadyExists",
"WouldBlock",
"InvalidInput",
"InvalidData",
"TimedOut",
"WriteZero",
"Interrupted",
"UnexpectedEof",
"Other",
};

interface Builder {
constructor();
[Name=from_config]
Expand All @@ -114,6 +170,9 @@ interface Builder {
void set_announcement_addresses(sequence<SocketAddress> announcement_addresses);
[Throws=BuildError]
void set_node_alias(string node_alias);
void set_tier_store_retry_config(RetryConfig retry_config);
void set_tier_store_backup(DynStore backup_store);
void set_tier_store_ephemeral(DynStore ephemeral_store);
[Throws=BuildError]
void set_async_payments_role(AsyncPaymentsRole? role);
[Throws=BuildError]
Expand All @@ -126,6 +185,8 @@ interface Builder {
Node build_with_vss_store_and_fixed_headers(NodeEntropy node_entropy, string vss_url, string store_id, record<string, string> fixed_headers);
[Throws=BuildError]
Node build_with_vss_store_and_header_provider(NodeEntropy node_entropy, string vss_url, string store_id, VssHeaderProvider header_provider);
[Throws=BuildError]
Node build_with_tier_store(NodeEntropy node_entropy, DynStore primary_store);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we now also expose Builder::build_with_store?

};

interface Node {
Expand Down
Loading