Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into minimize-instrume…
Browse files Browse the repository at this point in the history
…nted-mutex-lock-contention
  • Loading branch information
arturmelanchyk committed Mar 4, 2024
2 parents d875c8a + c7265c6 commit 2d77b7b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_NEW_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

performance-test-suite-detect-runners:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ immudb!](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&lab

Don't forget to ⭐ this repo if you like immudb!

[:tada: 20M pulls from docker hub!](https://hub.docker.com/r/codenotary)
[:tada: 23M pulls from docker hub!](https://hub.docker.com/r/codenotary)

---

Expand All @@ -36,7 +36,7 @@ Detailed documentation can be found at https://docs.immudb.io/

<img align="right" src="img/immudb-mascot-small.png" width="256px"/>

immudb is a database with built-in cryptographic proof and verification. It tracks changes in sensitive data and the integrity of the history will be protected by the clients, without the need to trust the database. It can operate both as a key-value store, and/or as relational database (SQL).
immudb is a database with built-in cryptographic proof and verification. It tracks changes in sensitive data and the integrity of the history will be protected by the clients, without the need to trust the database. It can operate as a key-value store, as a document model database, and/or as relational database (SQL).

Traditional database transactions and logs are mutable, and therefore there is no way to know for sure if your data has been compromised. immudb is immutable. You can add new versions of existing records, but never change or delete records. This lets you store critical data without fear of it being tampered.

Expand All @@ -60,7 +60,7 @@ Click here to try out the immudb web console access in an [online demo environme

| Topic | Description |
| ----------------------- | -------------------------------------------------- |
| DB Model | Key-Value store with 3D access (tx-key-value), SQL |
| DB Model | Key-Value with 3D access, Document Model, SQL |
| Data scheme | schema-free |
| Implementation design | Cryptographic commit log with parallel Merkle Tree,|
| | (sync/async) indexing with extended B-tree |
Expand Down
25 changes: 13 additions & 12 deletions embedded/cache/lru_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func (c *LRUCache) Resize(size int) {
}

func (c *LRUCache) Put(key interface{}, value interface{}) (rkey interface{}, rvalue interface{}, err error) {
c.mutex.Lock()
defer c.mutex.Unlock()

if key == nil || value == nil {
return nil, nil, ErrIllegalArguments
}

c.mutex.Lock()
defer c.mutex.Unlock()

e, ok := c.data[key]

if ok {
Expand Down Expand Up @@ -110,13 +110,13 @@ func (c *LRUCache) evict() (rkey interface{}, rvalue interface{}, err error) {
}

func (c *LRUCache) Get(key interface{}) (interface{}, error) {
c.mutex.Lock()
defer c.mutex.Unlock()

if key == nil {
return nil, ErrIllegalArguments
}

c.mutex.Lock()
defer c.mutex.Unlock()

e, ok := c.data[key]
if !ok {
return nil, ErrKeyNotFound
Expand All @@ -128,13 +128,13 @@ func (c *LRUCache) Get(key interface{}) (interface{}, error) {
}

func (c *LRUCache) Pop(key interface{}) (interface{}, error) {
c.mutex.Lock()
defer c.mutex.Unlock()

if key == nil {
return nil, ErrIllegalArguments
}

c.mutex.Lock()
defer c.mutex.Unlock()

e, ok := c.data[key]
if !ok {
return nil, ErrKeyNotFound
Expand All @@ -146,12 +146,13 @@ func (c *LRUCache) Pop(key interface{}) (interface{}, error) {
}

func (c *LRUCache) Replace(k interface{}, v interface{}) (interface{}, error) {
c.mutex.Lock()
defer c.mutex.Unlock()

if k == nil {
return nil, ErrIllegalArguments
}

c.mutex.Lock()
defer c.mutex.Unlock()

e, ok := c.data[k]
if !ok {
return nil, ErrKeyNotFound
Expand Down

0 comments on commit 2d77b7b

Please sign in to comment.