Skip to content

Commit

Permalink
Release 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
crossdbdev committed Jun 13, 2023
1 parent ae481de commit a872c86
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 18 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

## 0.3.0 <small>(2023-06-13)</small> {#0.3.0}

Features

- Support MacOS (X64 and ARM64)
- Change `CROSS_DB_XXX` to `CROSS_XXX`

Bug Fixes

- `cross_dbTblCreate` flags `CROSS_DB_RBTREE` doesn't create Primary Key Index type correctly


## 0.2.0 <small>(2023-06-07)</small> {#0.2.0}

Features
Expand All @@ -9,6 +21,7 @@ Features

Bug Fixes


## 0.1.0 <small>(2023-06-03)</small> {#0.1.0}

- **Initial release**
Expand Down
49 changes: 34 additions & 15 deletions crossdb.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Copyright 2022-2023 CrossDB.ORG. All rights reserved.
*
* https://crossdb.org
* https://github.com/crossdb-org/crossdb
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __CROSS_DB_H__
#define __CROSS_DB_H__

Expand Down Expand Up @@ -141,31 +160,31 @@ typedef struct cross_field_t {

/* DB DDL flags
*/
// DB Storage mode, default is CROSS_DB_ONDISK
#define CROSS_DB_ONDISK (0<<0) // DB is on persistent disk, survive with power cycle
#define CROSS_DB_RAMDISK (1<<0) // DB is on ramdisk/tmpfs/ramfs, survive with process restart, lose after power cycle
#define CROSS_DB_INMEM (2<<0) // DB is in memory, survie when process is runnig, lose after process terminates
// DB Storage mode, default is CROSS_ONDISK
#define CROSS_ONDISK (0<<0) // DB is on persistent disk, survive with power cycle
#define CROSS_RAMDISK (1<<0) // DB is on ramdisk/tmpfs/ramfs, survive with process restart, lose after power cycle
#define CROSS_INMEM (2<<0) // DB is in memory, survie when process is runnig, lose after process terminates

// DB Access mode, default is CROSS_DB_EXCLUSIVE
#define CROSS_DB_EXCLUSIVE (0<<2) // DB is used exclusively by single process
#define CROSS_DB_SHARED (1<<2) // DB is shared by multiple processes
// DB Access mode, default is CROSS_EXCLUSIVE
#define CROSS_EXCLUSIVE (0<<2) // DB is used exclusively by single process
#define CROSS_SHARED (1<<2) // DB is shared by multiple processes

// DB Lock mode, default is CROSS_DB_AUTOLOCK
#define CROSS_DB_AUTOLOCK (0<<3) // DB will do lock automatically
//#define CROSS_DB_NOLOCK (1<<3) // TBD: User is responsible for call locking APIs
// DB Lock mode, default is CROSS_AUTOLOCK
#define CROSS_AUTOLOCK (0<<3) // DB will do lock automatically
//#define CROSS_NOLOCK (1<<3) // TBD: User is responsible for call locking APIs

#define CROSS_DB_OPEN (1<<4) // don't create if not exist
#define CROSS_OPEN (1<<4) // don't create if not exist

// Index Type
#define CROSS_DB_HASH (0<<8) // hash index
#define CROSS_DB_RBTREE (1<<8) // rbtree index
#define CROSS_HASH (0<<8) // hash index
#define CROSS_RBTREE (1<<8) // rbtree index
// Unique index
#define CROSS_DB_UNIQUE (1<<11) // unique index
#define CROSS_UNIQUE (1<<11) // unique index


/* DB DML flags
*/
#define CROSS_DB_REUSE (1<<16) // reuse handle
#define CROSS_REUSE (1<<16) // reuse handle


/******************************************************************************
Expand Down
10 changes: 9 additions & 1 deletion examples/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
name=`echo $1|cut -f1 -d.`

if [ -e libcrossdb.so ]; then
# Linux/FreeBSD
echo Build $1 -> $name.bin
$CC -o $name.bin -Wall -O2 $1 -I.. libcrossdb.so -lpthread -ldl
$CC -o $name.bin -Wall -O2 $1 -I.. ./libcrossdb.so -lpthread -ldl
elif [ -e crossdb.dll ]; then
# Windows MINGW
echo Build $1 -> $name.exe
$CC -o $name.exe -Wall -O2 $1 -I.. crossdb.dll
elif [ -e libcrossdb.dylib ]; then
# MacOS
$CC -o x64-$name.bin -arch x86_64 -Wall -O2 $1 -I.. ./libcrossdb.dylib
$CC -o arm64e-$name.bin -arch arm64e -Wall -O2 $1 -I.. ./libcrossdb.dylib
lipo -create -output $name.bin x64-$name.bin arm64e-$name.bin
rm -f x64-$name.bin arm64e-$name.bin
fi
4 changes: 2 additions & 2 deletions examples/tutorial.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ int main ()

// Reuse cursor to get routes where nexthop=10.1.2.254
route.nexthop = IP4ADDR(10,1,2,254);
count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop", &route, CROSS_DB_REUSE);
count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop", &route, CROSS_REUSE);
EXPECT (count, 2, " Query nexthop=10.1.2.254 routes");
while (CROSS_OK == cross_cursorGetNextRow (hCursor, &route, 0)) {
DUMP_ROUTE (" route: ", route);
}

// Reuse cursor to get routes where nexthop!=10.1.2.254
route.nexthop = IP4ADDR(10,1,2,254);
count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop!=", &route, CROSS_DB_REUSE);
count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop!=", &route, CROSS_REUSE);
EXPECT (count, 1, " Query nexthop!=10.1.2.254 routes");
while (CROSS_OK == cross_cursorGetNextRow (hCursor, &route, 0)) {
DUMP_ROUTE (" route: ", route);
Expand Down

0 comments on commit a872c86

Please sign in to comment.