kandi background
Explore Kits

mapdb | MapDB provides concurrent Maps, Sets and Queues backed | Database library

 by   jankotek Java Version: Current License: Apache-2.0

 by   jankotek Java Version: Current License: Apache-2.0

Download this library from

kandi X-RAY | mapdb Summary

mapdb is a Java library typically used in Database applications. mapdb has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.
[![Build Status](https://travis-ci.org/jankotek/mapdb.svg?branch=master)](https://travis-ci.org/jankotek/mapdb) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.mapdb/mapdb/badge.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapdb%22%20AND%20a%3Amapdb) [![Join the chat at https://gitter.im/jankotek/mapdb](https://badges.gitter.im/jankotek/mapdb.svg)](https://gitter.im/jankotek/mapdb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • mapdb has a highly active ecosystem.
  • It has 4372 star(s) with 837 fork(s). There are 328 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 146 open issues and 731 have been closed. On average issues are closed in 114 days. There are 6 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of mapdb is current.
mapdb Support
Best in #Database
Average in #Database
mapdb Support
Best in #Database
Average in #Database

quality kandi Quality

  • mapdb has 0 bugs and 0 code smells.
mapdb Quality
Best in #Database
Average in #Database
mapdb Quality
Best in #Database
Average in #Database

securitySecurity

  • mapdb has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • mapdb code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
mapdb Security
Best in #Database
Average in #Database
mapdb Security
Best in #Database
Average in #Database

license License

  • mapdb is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
mapdb License
Best in #Database
Average in #Database
mapdb License
Best in #Database
Average in #Database

buildReuse

  • mapdb releases are not available. You will need to build from source code and install.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • mapdb saves you 9938 person hours of effort in developing the same functionality from scratch.
  • It has 20243 lines of code, 2041 functions and 135 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
mapdb Reuse
Best in #Database
Average in #Database
mapdb Reuse
Best in #Database
Average in #Database
Top functions reviewed by kandi - BETA

kandi has reviewed mapdb and discovered the below as its top functions. This is intended to give you an instant insight into mapdb implemented functionality, and help decide if they suit your requirements.

  • Compacts the index file .
  • Reload the file .
  • Removes the element with the given key .
  • Create a factory to create a single index volume .
  • Search for a value in the sorted array and return the index .
  • Returns a string representation of this map .
  • Pack an integer value .
  • Serialize a sequence of bytes .
  • Searches for a key in a sorted order .
  • Returns the next 32 bit value .

mapdb Key Features

Drop-in replacement for Maps, Lists, Queues and other collections.

Off-heap collections not affected by Garbage Collector

Multilevel cache with expiration and disk overflow.

RDBMs replacement with transactions, MVCC, incremental backups etc…

Local data processing and filtering. MapDB has utilities to process huge quantities of data in reasonable time.

MapDB: database engine

copy iconCopydownload iconDownload
Maven snippet, VERSION is [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.mapdb/mapdb/badge.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapdb%22%20AND%20a%3Amapdb)

```xml
<dependency>
    <groupId>org.mapdb</groupId>
    <artifactId>mapdb</artifactId>
    <version>VERSION</version>
</dependency>
```

Hello world:

```java
//import org.mapdb.*
DB db = DBMaker.memoryDB().make();
ConcurrentMap map = db.hashMap("map").make();
map.put("something", "here");
```

You can continue with [quick start](https://jankotek.gitbooks.io/mapdb/content/quick-start/) or refer to the  [documentation](https://jankotek.gitbooks.io/mapdb/).

Support
------------

More [details](http://www.mapdb.org/support/).

Development
--------------------

MapDB is written in Kotlin, you will need IntelliJ Idea.

You can use Gradle to build MapDB.

MapDB is extensively unit-tested.
By default, only tiny fraction of all tests are executed, so build finishes under 10 minutes.
Full test suite has over million test cases and runs for several hours/days.
To run full test suite, set `-Dmdbtest=1` VM option.

Longer unit tests might require more memory. Use this to increase heap memory assigned to unit tests: `-DtestArgLine="-Xmx3G"`

By default unit tests are executed in 3 threads. Thread count is controlled by `-DtestThreadCount=3` property

On machine with limited memory you can change fork mode so unit test consume less RAM, but run longer: `-DtestReuseForks=false`

Editing array also changes another array

copy iconCopydownload iconDownload
string[] _CompleteMap = CurrentMap.MapData;
string[] _CompleteMap = CurrentMap.MapData.ToArray();
class Person
{
    public string Name { get; set; }
}

class Program
{
    static void Main()
    {
        // Original array has a person named John
        Person[] people = new [] { new Person { Name = "John" } };

        // Create a shallow copy of the array
        Person[] peopleCopy = people.ToArray();

        // Change John's name in the copy
        peopleCopy[0].Name = "James";

        // At this point, people[0].Name is also "James", since it's the same person!

        // However changes to the array itself are discreet
        peopleCopy[0] = new Person { Name = "Mary" };

        // At this point, people[0].Name is still "James", since we did
        // not modify the existing object, but instead created a new one
    }
}
-----------------------
string[] _CompleteMap = CurrentMap.MapData;
string[] _CompleteMap = CurrentMap.MapData.ToArray();
class Person
{
    public string Name { get; set; }
}

class Program
{
    static void Main()
    {
        // Original array has a person named John
        Person[] people = new [] { new Person { Name = "John" } };

        // Create a shallow copy of the array
        Person[] peopleCopy = people.ToArray();

        // Change John's name in the copy
        peopleCopy[0].Name = "James";

        // At this point, people[0].Name is also "James", since it's the same person!

        // However changes to the array itself are discreet
        peopleCopy[0] = new Person { Name = "Mary" };

        // At this point, people[0].Name is still "James", since we did
        // not modify the existing object, but instead created a new one
    }
}
-----------------------
string[] _CompleteMap = CurrentMap.MapData;
string[] _CompleteMap = CurrentMap.MapData.ToArray();
class Person
{
    public string Name { get; set; }
}

class Program
{
    static void Main()
    {
        // Original array has a person named John
        Person[] people = new [] { new Person { Name = "John" } };

        // Create a shallow copy of the array
        Person[] peopleCopy = people.ToArray();

        // Change John's name in the copy
        peopleCopy[0].Name = "James";

        // At this point, people[0].Name is also "James", since it's the same person!

        // However changes to the array itself are discreet
        peopleCopy[0] = new Person { Name = "Mary" };

        // At this point, people[0].Name is still "James", since we did
        // not modify the existing object, but instead created a new one
    }
}

org.mapdb.DBException$SerializationError when storing JSONArray in MapDB using ELSA Serialization

copy iconCopydownload iconDownload
Class SomeClassSerialzer extends GroupSerializerObjectArray<SomeClass> {
@Override
    public void serialize(DataOutput2 dataOutput2, SomeClass someClass) throws IOException {
        dataOutput2.writeLong(someClass.getLong());
        dataOutput2.writeUTF(threatSourceData.getJSONArray().toString());
    }

    @Override
    public SomeClass deserialize(DataInput2 dataInput2, int i) throws IOException {
        JSONArray jsonArray = null;
        Long longValue = dataInput2.readLong();
        try {
            categories = new JSONArray(dataInput2.readUTF());
        } catch (JSONException ignored) {
        }
        return new SomeClass(reputation, categories);
    }
}
NavigableMap<Long,SomeClass> treeMap = mapDB.treeMap(treeName).keySerializer(Serializer.LONG).valueSerializer(new ThreatSourceDataSerializer()).createOrOpen();
-----------------------
Class SomeClassSerialzer extends GroupSerializerObjectArray<SomeClass> {
@Override
    public void serialize(DataOutput2 dataOutput2, SomeClass someClass) throws IOException {
        dataOutput2.writeLong(someClass.getLong());
        dataOutput2.writeUTF(threatSourceData.getJSONArray().toString());
    }

    @Override
    public SomeClass deserialize(DataInput2 dataInput2, int i) throws IOException {
        JSONArray jsonArray = null;
        Long longValue = dataInput2.readLong();
        try {
            categories = new JSONArray(dataInput2.readUTF());
        } catch (JSONException ignored) {
        }
        return new SomeClass(reputation, categories);
    }
}
NavigableMap<Long,SomeClass> treeMap = mapDB.treeMap(treeName).keySerializer(Serializer.LONG).valueSerializer(new ThreatSourceDataSerializer()).createOrOpen();

I want to add a property to JSON Object with an array of integers as a value in Java

copy iconCopydownload iconDownload
private void simpleJsonObjectWithArrayAsValue() throws JSONException {
    JSONObject jo = new JsonObject();
    jo.put("id", Json.createValue(1));
    jo.put("name", Json.createValue("Whatever"));
    jo.put("indices", Json.createArrayBuilder()
        .add(1)
        .add(2)
        .add(3)
        .build());

    System.out.println("JSON String = " + new StringBuffer().append(jo.toString() + "\n");
}

Community Discussions

Trending Discussions on mapdb
  • how BoxStoreBuilder.usePreviousCommit works internally?
  • Editing array also changes another array
  • org.mapdb.DBException$SerializationError when storing JSONArray in MapDB using ELSA Serialization
  • I want to add a property to JSON Object with an array of integers as a value in Java
Trending Discussions on mapdb

QUESTION

how BoxStoreBuilder.usePreviousCommit works internally?

Asked 2021-Nov-08 at 15:09

i converted my android app from mapdb to objectbox, i've seen on github a few people reporting database corruption with objectbox and the solution has always been to call usePreviousCommit in case of problems.

since the objectbox core is close source I wanted to know what usePreviousCommit does internally

  • are there 2 physical copies of the database? and calling usePreviousCommit reverts to the previous copy?

  • or does it work in a more complex way? (if yes i wanted to know how)

i opened this question because i want more information from objectbox before i continue to use it in production.

ANSWER

Answered 2021-Nov-08 at 15:09

The key word is multiversion-concurrency. Think of a B+ tree with copy-on-write. The previous root tree (aka the previous commit) is preserved, so you can use when opening.

Source https://stackoverflow.com/questions/69838505

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install mapdb

You can download it from GitHub, Maven.
You can use mapdb like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the mapdb component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Compare Database Libraries with Highest Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.