Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #62 from karczex/documentation
Browse files Browse the repository at this point in the history
Documentation
  • Loading branch information
Szymon Romik authored Jun 30, 2020
2 parents eb3fe7b + 301f547 commit 392c5bc
Show file tree
Hide file tree
Showing 17 changed files with 423 additions and 8 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ PMEM_IS_PMEM_FORCE=1 java -ea -Xms1G -cp .:`find ../src/main/target -name *.jar`

## Documentation

After installation, docs can be generated using ... by executing commands:
Docs can be generated using mvn by executing commands:

```sh
...
mvn javadoc:javadoc
```
4 changes: 4 additions & 0 deletions src/main/java/io/pmem/pmemkv/BuilderException.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
package io.pmem.pmemkv;

@SuppressWarnings("serial")

/**
* Pmemkv database configuration failed
*/
public class BuilderException extends DatabaseException {

public BuilderException(String message) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/io/pmem/pmemkv/ByteBufferConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

import java.nio.ByteBuffer;

/**
* Impementation of Converter interface for ByteBuffer type
*/
public class ByteBufferConverter implements Converter<ByteBuffer> {
public ByteBuffer toByteBuffer(ByteBuffer entry) {
return entry;
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/io/pmem/pmemkv/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,32 @@

import java.nio.ByteBuffer;

/**
* Helper interface, which provides functionality of storing objects of any type
* as ByteBuffer inside pmemkv datastore
*
* @param <T>
* the type of an object, which will be converted to ByteBuffer and
* stored in pmemkv
*/
public interface Converter<T> {
/**
* Defines how object of type T will be converted to ByteBuffer and stored in
* pmemkv
*
* @param entry
* Object of type T, which will be stored in pmemkv
* @return ByteBuffer representation of passed objects
*/
public ByteBuffer toByteBuffer(T entry);

/**
* Defines how object stored in pmemkv will be converted from ByteBuffer back to
* type T to be passed to the callback functions
*
* @param entry
* ByteBuffer stored in pmemkv
* @return Object of type T, which will be passed to the callback functions
*/
public T fromByteBuffer(ByteBuffer entry);
}
Loading

0 comments on commit 392c5bc

Please sign in to comment.