Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
joeinman committed Sep 1, 2023
1 parent af689ed commit 7902d1d
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![CMake](https://github.com/joeinman/FlashKV/actions/workflows/cmake.yml/badge.svg)

FlashKV is a lightweight, hardware agnostic key-value store for flash memory. It provides an easy-to-use interface for storing, reading, and erasing key-value pairs in flash memory.
FlashKV is a lightweight, hardware agnostic key-value map for flash memory. It provides an easy-to-use interface for storing, reading, and erasing key-value pairs in flash memory.

## Features:

Expand All @@ -17,7 +17,7 @@ FlashKV is a lightweight, hardware agnostic key-value store for flash memory. It
#include <optional>
#include <vector>

// Define the size of the FlashKV store
// Define the size of the FlashKV map
#define FLASHKV_SIZE 4096
#define FLASHKV_BASE 0

Expand All @@ -43,31 +43,30 @@ int main()
FLASHKV_SIZE);
);

// Load The Store From Flash
int loadStatus = flashKV.loadStore();
if (loadStatus == 0)
std::cout << "FlashKV Store Loaded Successfully" << std::endl;
// Load The Map From Flash
if (flashKV.loadMap())
std::cout << "FlashKV Map Loaded Successfully" << std::endl;
else
std::cout << "Error Occurred While Loading The FlashKV Store" << std::endl;
std::cout << "Error Occurred While Loading The FlashKV Map" << std::endl;

// Try To Read A Value From The Store
// Try To Read A Value From The Map
std::string key = "test";
std::optional<std::vector<uint8_t>> value = flashKV.readKey(key);
if (value)
std::cout << "Key [" << key << "] Found." << std::endl;
else
std::cout << "Key [" << key << "] Not Found." << std::endl;

// Write A Value To The Store
// Write A Value To The Map
std::vector<uint8_t> data = {0x01, 0x02, 0x03, 0x04};
flashKV.writeKey(key, data);
std::cout << "Writing Key: [" << key << "]" << std::endl;

// Save The Store To Flash
if (flashKV.saveStore())
std::cout << "FlashKV Store Saved Successfully" << std::endl;
// Save The Map To Flash
if (flashKV.saveMap())
std::cout << "FlashKV Map Saved Successfully" << std::endl;
else
std::cout << "Error Occurred While Saving The FlashKV Store" << std::endl;
std::cout << "Error Occurred While Saving The FlashKV Map" << std::endl;

return 0;
}
Expand Down

0 comments on commit 7902d1d

Please sign in to comment.