Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tanmaykm/foundationdb.jl
FoundationDB client in Julia
https://github.com/tanmaykm/foundationdb.jl
foundationdb foundationdb-client julia julialang
Last synced: about 1 month ago
JSON representation
FoundationDB client in Julia
- Host: GitHub
- URL: https://github.com/tanmaykm/foundationdb.jl
- Owner: tanmaykm
- License: other
- Created: 2018-05-02T13:15:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-10T03:26:44.000Z (almost 6 years ago)
- Last Synced: 2024-10-14T16:43:47.393Z (about 1 month ago)
- Topics: foundationdb, foundationdb-client, julia, julialang
- Language: Julia
- Size: 54.7 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# FoundationDB Julia Client
[![Build Status](https://travis-ci.org/tanmaykm/FoundationDB.jl.svg?branch=master)](https://travis-ci.org/tanmaykm/FoundationDB.jl)
[![Coverage Status](https://coveralls.io/repos/tanmaykm/FoundationDB.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/tanmaykm/FoundationDB.jl?branch=master)
[![codecov.io](http://codecov.io/github/tanmaykm/FoundationDB.jl/coverage.svg?branch=master)](http://codecov.io/github/tanmaykm/FoundationDB.jl?branch=master)The current implementation covers all of the C-APIs, and provides an easy to use Julia API layer over it for simple key-value pairs.
The Julia APIs are quite easy to follow, with this example:
```
using FoundationDBopen(FDBCluster()) do cluster # Read cluster configuration
open(FDBDatabase(cluster)) do db # Open the database
key = UInt8[0,1,2] # This is a key, and ...
val = UInt8[9, 9, 9] # this is a value. Both are byte arrays.
open(FDBTransaction(db)) do tran # Start a transaction
@test clearkey(tran, key) == nothing # Delete a key if present
@test getval(tran, key) == nothing # Get value for a key (nothing if not present)
@test setval(tran, key, val) == nothing # Set value for a key
@test getval(tran, key) == val # We get the value, once it has been set
@test commit(tran) # Commit changes we made in our snapshot
@test_throws FDBError commit(tran) # We can only commit once.
endopen(FDBTransaction(db)) do tran # Open a new transaction
@test clearkey(tran, key) == nothing # Delete a key
@test getval(tran, key) == nothing
end # Transactions are auto-committed by default!
# And also retried automatically when possibleopen(FDBTransaction(db)) do tran # Need a transaction even for read operation
@test getval(tran, key) == nothing
end # Reads don't have to be committed
end
end
```Note: The Julia implementation makes use of Julia threading APIs. Make sure you have enabled threading and have at least two threads configured for Julia. E.g.:
```
$> JULIA_NUM_THREADS=2
$> export JULIA_NUM_THREADS
$> julia -e 'using Pkg; Pkg.test("FoundationDB")'
```