Commit Graph

17 Commits

Author SHA1 Message Date
Oliver Gugger
4f06f58791
Merge pull request #8483 from ProofOfKeags/feature/for-loop-destroyer
fn: add slice utilities
2024-03-08 01:48:38 -06:00
Keagan McClelland
2bd9911804 fn: add slice utilities
In the year of our lord 2024 we should not be writing for loops
for standard operations. Here we introduce named slice operations
not found in the golang slices package. Note all these functions
are pure.
2024-03-02 11:43:07 -08:00
Olaoluwa Osuntokun
166b2fdb97 fn: add UnwrapOrErr and UnwrapOrFail to Option
In this commit, we add two new methods that simplify usage of an
handling a value wrapped in an Option. Thes methods allow a caller to
force the nil/None check up front, and either obtain the value, or fail
the current execution or test.

This should replace most usages of `UnsafeFromSome` where ever used
today.
2024-02-24 17:21:37 -08:00
Olaoluwa Osuntokun
1d1c1382d0
fn: add utility funcs/method for option type 2024-01-23 19:09:59 -08:00
Olaoluwa Osuntokun
1fc3f14467
fn: add new generic set container 2024-01-23 19:09:53 -08:00
Olaoluwa Osuntokun
eb72bb9712
fn: add SendOrQuit 2024-01-23 19:09:50 -08:00
Olaoluwa Osuntokun
a2694009cd
fn: add basic generic chan recv utility funcs 2024-01-23 19:09:47 -08:00
Olaoluwa Osuntokun
f7e2e6ddd6
fn: add basic generic queue 2024-01-23 19:09:45 -08:00
Olaoluwa Osuntokun
f166829fe4
fn: add reduce func 2024-01-23 19:09:42 -08:00
Olaoluwa Osuntokun
d702158d9b
fn: add new EventPublisher event pub/sub system
This builds on the concurrent queue to create a generic way to allow
goroutines to pub/sub information. An example includes being notified
each time a state machine is able to carry out a new state transition.
2024-01-23 19:09:39 -08:00
Olaoluwa Osuntokun
1cbfda525a
fn: add new Either[L, R] type
This implements a union of two values. Uses the existing option under
the hood, and adds a simple helper function.
2024-01-23 19:09:36 -08:00
Olaoluwa Osuntokun
0715e84f04
fn: add new ConcurrentQueue[T] data structure
This is a version of the queue we have elsewhere, but we can get rid of
all the casting and interface usage in favor of a type param.
2024-01-23 19:09:29 -08:00
Keagan McClelland
2499813414 fn: add UnsafeFromSome to Option API 2024-01-11 16:40:48 -08:00
Olaoluwa Osuntokun
b0114efad3
fn: create new sub-module
In this commit, we make a new sub-module from the `fn` package. This
lets other projects use it w/o pulling in all of lnd, and also other
sub-packages within lnd.

We also add a temp replace directive for new module.  We'll remove this
once we tag the final version.
2023-12-06 17:00:10 -08:00
Keagan McClelland
b298c84d21 fn: introduce option type
this commit introduces many of the most common functions you will
want to use with the Option type. Not all of them are used
immediately in this PR.
2023-11-10 13:29:30 -08:00
yyforyongyu
89b0e25e2c
multi: add lnutils to host fundamental utility functions
We also move the `fn/stream.go` into the package `lnutils`. Eventually
we will put all the [utility
functions](https://github.com/lightninglabs/taro/tree/main/chanutils)
into this package.
2023-01-19 06:38:50 +08:00
Olaoluwa Osuntokun
adb239300f
fn: add new fn (func utils) package for generic helper funcs
We start with a simple Map function that can be useful for transforming
objects on the fly.

We may want to eventually make this Taro pakage into a module so we can
just have everything in one place:
https://github.com/lightninglabs/taro/tree/main/chanutils.
2022-12-15 11:56:31 -08:00