Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite CNID backend #1570

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
perl \
pkgconfig \
rpcsvc-proto-dev \
sqlite-dev \
talloc-dev \
tracker \
tracker-dev \
Expand Down Expand Up @@ -127,6 +128,7 @@ jobs:
perl \
pkgconfig \
rpcsvc-proto \
sqlite \
talloc \
tinysparql \
unicode-character-database
Expand Down Expand Up @@ -183,6 +185,7 @@ jobs:
libldap2-dev \
libmariadb-dev \
libpam0g-dev \
libsqlite3-dev \
libtalloc-dev \
libtirpc-dev \
libtracker-sparql-3.0-dev \
Expand Down Expand Up @@ -253,6 +256,7 @@ jobs:
perl \
perl-Net-DBus \
quota-devel \
sqlite-devel \
systemd \
systemtap-sdt-devel \
tracker \
Expand Down Expand Up @@ -314,6 +318,7 @@ jobs:
pam-devel \
perl \
pkg-config \
sqlite3-devel \
systemd \
systemtap-sdt-devel \
tcpd-devel \
Expand Down Expand Up @@ -424,7 +429,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install berkeley-db cmark-gfm docbook-xsl libxslt meson mysql talloc
brew install berkeley-db cmark-gfm docbook-xsl libxslt meson mysql sqlite talloc
- name: Configure
run: |
meson setup build \
Expand Down Expand Up @@ -482,6 +487,7 @@ jobs:
py39-gdbm \
py39-sqlite3 \
py39-tkinter \
sqlite \
talloc \
tracker3
run: |
Expand Down Expand Up @@ -525,6 +531,7 @@ jobs:
p5-Net-DBus \
perl5 \
pkgconf \
sqlite3 \
talloc \
tracker3
run: |
Expand Down Expand Up @@ -580,6 +587,7 @@ jobs:
p5-Net-DBus \
perl \
pkg-config \
sqlite3 \
talloc \
tex-unicode-data
run: |
Expand Down Expand Up @@ -635,6 +643,7 @@ jobs:
openpam \
p5-Net-DBus \
pkgconf \
sqlite \
tracker3
run: |
set -e
Expand Down Expand Up @@ -682,6 +691,7 @@ jobs:
libxslt \
meson \
mysql-client \
sqlite3 \
talloc
run: |
set -e
Expand Down Expand Up @@ -728,7 +738,8 @@ jobs:
libgcrypt \
ninja \
pkg-config \
python/pip
python/pip \
sqlite-3
pip install meson
run: |
set -e
Expand Down
3 changes: 3 additions & 0 deletions etc/afpd/afp_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ static void show_version( void )
#endif
#ifdef CNID_BACKEND_MYSQL
printf( "mysql " );
#endif
#ifdef CNID_BACKEND_SQLITE
printf( "sqlite " );
#endif
puts( "" );
}
Expand Down
5 changes: 4 additions & 1 deletion etc/cnid_dbd/cmd_dbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ int main(int argc, char **argv)
}

/* open volume */
if (STRCMP(vol->v_cnidscheme, != , "dbd") && STRCMP(vol->v_cnidscheme, != , "mysql")) {
if (STRCMP(vol->v_cnidscheme, != , "dbd")
&& STRCMP(vol->v_cnidscheme, != , "mysql")
&& STRCMP(vol->v_cnidscheme, != , "sqlite")
) {
dbd_log(LOGSTD, "\"%s\" isn't a \"dbd\" CNID volume", vol->v_path);
exit(EXIT_FAILURE);
}
Expand Down
4 changes: 4 additions & 0 deletions etc/cnid_dbd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if use_dbd_backend
cnid_dbd_deps += mysqlclient
endif

if use_sqlite_backend
cnid_dbd_deps += sqlite_deps
endif

cnid_metad_sources = ['cnid_metad.c', 'usockfd.c', 'db_param.c']

dbd_sources = [
Expand Down
20 changes: 20 additions & 0 deletions include/atalk/cnid_sqlite_private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef _ATALK_CNID_SQLITE_PRIVATE_H
#define _ATALK_CNID_SQLITE_PRIVATE_H 1

#include <atalk/cnid_private.h>
#include <atalk/uuid.h>

#define CNID_SQLITE_FLAG_DEPLETED (1 << 0) /* CNID set overflowed */

typedef struct CNID_sqlite_private {
struct vol *vol;
uint32_t cnid_sqlite_flags;
sqlite3 *cnid_sqlite_con;
char *cnid_sqlite_voluuid_str;
cnid_t cnid_sqlite_hint;
sqlite3_stmt *cnid_lookup_stmt;
sqlite3_stmt *cnid_add_stmt;
sqlite3_stmt *cnid_put_stmt;
} CNID_sqlite_private;

#endif
8 changes: 8 additions & 0 deletions libatalk/cnid/cnid_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ extern struct _cnid_module cnid_dbd_module;
extern struct _cnid_module cnid_mysql_module;
#endif

#ifdef CNID_BACKEND_SQLITE
extern struct _cnid_module cnid_sqlite_module;
#endif

void cnid_init(void)
{
#ifdef CNID_BACKEND_LAST
Expand All @@ -57,4 +61,8 @@ void cnid_init(void)
#ifdef CNID_BACKEND_MYSQL
cnid_register(&cnid_mysql_module);
#endif

#ifdef CNID_BACKEND_SQLITE
cnid_register(&cnid_sqlite_module);
#endif
}
6 changes: 6 additions & 0 deletions libatalk/cnid/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ if use_mysql_backend
libcnid_deps += mysql_deps
endif

if use_sqlite_backend
subdir('sqlite')
libcnid_libs += libcnid_sqlite
libcnid_deps += sqlite_deps
endif

cnid_sources = ['cnid_init.c', 'cnid.c']

libcnid = static_library(
Expand Down
Loading
Loading