Skip to content

Commit

Permalink
API changes: COMPARE_HASH_ONLY removed
Browse files Browse the repository at this point in the history
  • Loading branch information
JulStrat committed Aug 23, 2021
1 parent f5fd140 commit e849b43
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 44 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/arduino-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Aarduino-lint
name: arduino-lint
on: [push, pull_request]
jobs:
lint:
Expand All @@ -7,4 +7,6 @@ jobs:
- uses: actions/checkout@v2
- uses: arduino/arduino-lint-action@v1
with:
library-manager: update
library-manager: update
compliance: strict

4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ int readValue();

int readValue(void *buff, unsigned int byteNum);

void compareKeyExactly();

void compareHashOnly();

cdbResult close();
```
Expand Down
2 changes: 0 additions & 2 deletions examples/airports/airports.ino
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ void setup() {
SD.begin(10);

if (ucdb.open(fileName) == CDB_OK) {
// ucdb.compareHashOnly();

// Find some existing codes.
for (unsigned int i = 0; i < sizeof (air) / sizeof (const char *); i++) {
query(air[i], strlen(air[i]));
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=uCDB
version=0.3.0
version=0.4.0
author=Ioulianos Kakoulidis
maintainer=Ioulianos Kakoulidis <ioulianos.kakoulidis@hotmail.com>
sentence=API for querying Constant DataBase file store.
Expand Down
27 changes: 2 additions & 25 deletions src/uCDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
static unsigned long unpack(const byte buff[]);

uCDB::uCDB() {
cmp = COMPARE_KEY_EXACTLY;
state = CDB_CLOSED;
}

Expand Down Expand Up @@ -173,22 +172,8 @@ cdbResult uCDB::findNextValue() {

valueBytesAvail = dataValueLen;

switch (cmp) {
case COMPARE_HASH_ONLY:
if (cdb.seek(dataPos + CDB_DESCRIPTOR_SIZE + dataKeyLen)) {
return (state = KEY_FOUND);
}
else {
return (state = FILE_ERROR);
}

default:
if (keyLen_ != dataKeyLen) {
break; // Scan next slot
}
if (compareKey() == KEY_FOUND) {
return (state = KEY_FOUND);
}
if ((keyLen_ == dataKeyLen) & (compareKey() == KEY_FOUND)) {
return (state = KEY_FOUND);
}
}
}
Expand Down Expand Up @@ -226,14 +211,6 @@ int uCDB::readValue(void *buff, unsigned int byteNum) {
return cdb.read(buff, byteNum);
}

void uCDB::compareKeyExactly() {
cmp = COMPARE_KEY_EXACTLY;
}

void uCDB::compareHashOnly() {
cmp = COMPARE_HASH_ONLY;
}

cdbResult uCDB::close() {
cdb.close();
return (state = CDB_CLOSED);
Expand Down
10 changes: 0 additions & 10 deletions src/uCDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
#include <SPI.h>
#include <SD.h>

/** Key compare rule type */
enum compareRule {
COMPARE_KEY_EXACTLY = 0, //< Match key exactly (key hash, key length, key)
COMPARE_HASH_ONLY //< Match only key hash (key hash)
};

enum cdbResult {
CDB_OK = 0,
CDB_CLOSED, // Initial state
Expand Down Expand Up @@ -65,9 +59,6 @@ class uCDB
*/
int readValue(void *buff, unsigned int byteNum);

void compareKeyExactly();
void compareHashOnly();

/**
Close CDB
*/
Expand All @@ -76,7 +67,6 @@ class uCDB
private:
File cdb;
cdbResult state;
compareRule cmp;

const byte *key_;
unsigned long keyLen_;
Expand Down

0 comments on commit e849b43

Please sign in to comment.