forked from rabbitmq/khepri
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now, `khepri` is the main entry point for everything public. There is no longer a high-level API in `khepri` and a lower-level API in `khepri_machine`. `khepri` provides more user-friendly functions and we will add more when we see fit. Here are a few examples: * All functions accept both native paths (`[stock, wood, <<"oak">>]`) and Unix-like paths (`"/:stock/:wood/oak"`). Note that the syntax for Unix-like paths has changed: atoms are prefixed with `:` and binaries are left as-is. * `khepri:get_data(StoreId, PathPattern)` allows to quickly get the data attached to a specific node. It's easier than going through `khepri:get(StoreId, PathPattern)` and extracting the data from the returned map. Inside transactions, `khepri_tx` provides the same API as `khepri`, except when the function does not make sense in the context of a transaction. Unix-like paths are also accepted by `khepri_tx` functions. `khepri_cluster` is a new module to expose the clustering part of the API. This was in `khepri` before and was moved to this module. It is also part of the public interface. `khepri_path` and `khepri_condition` remain part of the public API for those needing to manipulate paths. Other modules are private however. They remain visible in the documentation because understaing the internals may help sometimes. But changes in those modules may not be documented in release notes and may not be reflected in the release versions.
- Loading branch information
Showing
27 changed files
with
3,196 additions
and
1,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,10 +89,6 @@ khepri:insert([emails, <<"alice">>], "[email protected]"). | |
khepri:insert("/:emails/alice", "[email protected]"). | ||
``` | ||
|
||
The `khepri` module provides the "simple API". It has several functions to | ||
cover the most common uses. For advanced uses, using the `khepri_machine` | ||
module directly is preferred. | ||
|
||
### Read data back | ||
|
||
To get Alice's email address back, **query** the same path: | ||
|
@@ -178,7 +174,7 @@ the database itself and automatically execute it after some event occurs. | |
on_action => Action} = Props | ||
end, | ||
|
||
khepri_machine:put( | ||
khepri:put( | ||
StoreId, | ||
StoredProcPath, | ||
#kpayload_sproc{sproc = Fun}))}. | ||
|
@@ -189,7 +185,7 @@ the database itself and automatically execute it after some event occurs. | |
```erlang | ||
EventFilter = #kevf_tree{path = [stock, wood, <<"oak">>]}, | ||
|
||
ok = khepri_machine:register_trigger( | ||
ok = khepri:register_trigger( | ||
StoreId, | ||
TriggerId, | ||
EventFilter, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.