Changeset: cb1a73c85c25 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cb1a73c85c25
Added Files:
        gdk/gdk_logger_internals.h
Modified Files:
        gdk/Makefile.ag
        gdk/gdk_logger.c
        gdk/gdk_logger.h
        sql/server/sql_mvc.c
        sql/storage/bat/bat_logger.c
        sql/storage/sql_storage.h
        sql/storage/store_sequence.c
Branch: default
Log Message:

Information hiding: remove stuff from gdk_logger.h and don't include it when 
not needed.


diffs (243 lines):

diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -29,7 +29,7 @@ lib_gdk = {
                gdk_posix.c gdk_logger.c gdk_sample.c xoshiro256starstar.h \
                gdk_private.h gdk_delta.h gdk_logger.h gdk_posix.h \
                gdk_system.h gdk_system_private.h gdk_tm.h gdk_storage.h \
-               gdk_geomlogger.h \
+               gdk_geomlogger.h gdk_logger_internals.h \
                gdk_group.c \
                gdk_imprints.c gdk_imprints.h \
                gdk_join.c gdk_project.c \
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -57,6 +57,7 @@
 #include "gdk.h"
 #include "gdk_private.h"
 #include "gdk_logger.h"
+#include "gdk_logger_internals.h"
 #include <string.h>
 
 /*
@@ -92,6 +93,8 @@
 #endif
 #endif
 
+#define BATSIZE 0
+
 #define NAME(name,tpe,id) (name?name:"tpe id")
 
 #define LOG_DISABLED(lg) ((lg)->debug&128)
@@ -118,6 +121,30 @@ static const char *log_commands[] = {
        "LOG_UPDATE_PAX",
 };
 
+typedef struct logaction {
+       int type;               /* type of change */
+       lng nr;
+       int ht;                 /* vid(-1),void etc */
+       int tt;
+       lng id;
+       char *name;             /* optional */
+       char tpe;               /* tpe of column */
+       oid cid;                /* id of object */
+       BAT *b;                 /* temporary bat with changes */
+       BAT *uid;               /* temporary bat with bun positions to update */
+} logaction;
+
+/* during the recover process a number of transactions could be active */
+typedef struct trans {
+       int tid;                /* transaction id */
+       int sz;                 /* sz of the changes array */
+       int nr;                 /* nr of changes */
+
+       logaction *changes;
+
+       struct trans *tr;
+} trans;
+
 typedef struct logformat_t {
        char flag;
        int tid;
diff --git a/gdk/gdk_logger.h b/gdk/gdk_logger.h
--- a/gdk/gdk_logger.h
+++ b/gdk/gdk_logger.h
@@ -11,74 +11,10 @@
 
 #define LOGFILE "log"
 
-typedef struct logaction {
-       int type;               /* type of change */
-       lng nr;
-       int ht;                 /* vid(-1),void etc */
-       int tt;
-       lng id;
-       char *name;             /* optional */
-       char tpe;               /* tpe of column */
-       oid cid;                /* id of object */
-       BAT *b;                 /* temporary bat with changes */
-       BAT *uid;               /* temporary bat with bun positions to update */
-} logaction;
-
-/* during the recover process a number of transactions could be active */
-typedef struct trans {
-       int tid;                /* transaction id */
-       int sz;                 /* sz of the changes array */
-       int nr;                 /* nr of changes */
-
-       logaction *changes;
-
-       struct trans *tr;
-} trans;
-
 typedef gdk_return (*preversionfix_fptr)(int oldversion, int newversion);
 typedef gdk_return (*postversionfix_fptr)(void *lg);
 
-typedef struct logger {
-       int debug;
-       int version;
-       lng changes;
-       lng id;
-       int tid;
-       bool with_ids;
-       bool inmemory;
-#ifdef GDKLIBRARY_OLDDATE
-       /* convert old date values to new */
-       bool convert_date;
-#endif
-       char *fn;
-       char *dir;
-       char *local_dir; /* the directory in which the log is written */
-       preversionfix_fptr prefuncp;
-       postversionfix_fptr postfuncp;
-       stream *log;
-       lng end;                /* end of pre-allocated blocks for faster 
f(data)sync */
-       /* Store log_bids (int) to circumvent trouble with reference counting */
-       BAT *catalog_bid;       /* int bid column */
-       BAT *catalog_nme;       /* str name column */
-       BAT *catalog_tpe;       /* type of column */
-       BAT *catalog_oid;       /* object identifier of column (the pair 
type,oid is unique) */
-       BAT *dcatalog;          /* deleted from catalog table */
-       BAT *seqs_id;           /* int id column */
-       BAT *seqs_val;          /* lng value column */
-       BAT *dseqs;             /* deleted from seqs table */
-       BAT *snapshots_bid;     /* int bid column */
-       BAT *snapshots_tid;     /* int tid column */
-       BAT *dsnapshots;        /* deleted from snapshots table */
-       BAT *freed;             /* snapshots can be created and destroyed,
-                                  in a single logger transaction.
-                                  These snapshot bats should be freed
-                                  directly (on transaction
-                                  commit). */
-       void *buf;
-       size_t bufsize;
-} logger;
-
-#define BATSIZE 0
+typedef struct logger logger;
 
 typedef int log_bid;
 
diff --git a/gdk/gdk_logger_internals.h b/gdk/gdk_logger_internals.h
new file mode 100644
--- /dev/null
+++ b/gdk/gdk_logger_internals.h
@@ -0,0 +1,52 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#ifndef _LOGGER_INTERNALS_H_
+#define _LOGGER_INTERNALS_H_
+
+struct logger {
+       int debug;
+       int version;
+       lng changes;
+       lng id;
+       int tid;
+       bool with_ids;
+       bool inmemory;
+#ifdef GDKLIBRARY_OLDDATE
+       /* convert old date values to new */
+       bool convert_date;
+#endif
+       char *fn;
+       char *dir;
+       char *local_dir; /* the directory in which the log is written */
+       preversionfix_fptr prefuncp;
+       postversionfix_fptr postfuncp;
+       stream *log;
+       lng end;                /* end of pre-allocated blocks for faster 
f(data)sync */
+       /* Store log_bids (int) to circumvent trouble with reference counting */
+       BAT *catalog_bid;       /* int bid column */
+       BAT *catalog_nme;       /* str name column */
+       BAT *catalog_tpe;       /* type of column */
+       BAT *catalog_oid;       /* object identifier of column (the pair 
type,oid is unique) */
+       BAT *dcatalog;          /* deleted from catalog table */
+       BAT *seqs_id;           /* int id column */
+       BAT *seqs_val;          /* lng value column */
+       BAT *dseqs;             /* deleted from seqs table */
+       BAT *snapshots_bid;     /* int bid column */
+       BAT *snapshots_tid;     /* int tid column */
+       BAT *dsnapshots;        /* deleted from snapshots table */
+       BAT *freed;             /* snapshots can be created and destroyed,
+                                  in a single logger transaction.
+                                  These snapshot bats should be freed
+                                  directly (on transaction
+                                  commit). */
+       void *buf;
+       size_t bufsize;
+};
+
+#endif /* _LOGGER_INTERNALS_H_ */
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -24,7 +24,6 @@
 #include "rel_semantic.h"
 #include "rel_unnest.h"
 #include "rel_optimizer.h"
-#include "gdk_logger.h"
 #include "wlc.h"
 
 #include "mal_authorize.h"
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -11,6 +11,7 @@
 #include "bat_utils.h"
 #include "sql_types.h" /* EC_POS */
 #include "wlc.h"
+#include "gdk_logger_internals.h"
 
 #define CATALOG_MAR2018 52201
 #define CATALOG_AUG2018 52202
diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h
--- a/sql/storage/sql_storage.h
+++ b/sql/storage/sql_storage.h
@@ -10,7 +10,6 @@
 #define SQL_STORAGE_H
 
 #include "sql_catalog.h"
-#include "gdk_logger.h"
 #include "store_sequence.h"
 
 #define COLSIZE        1024
diff --git a/sql/storage/store_sequence.c b/sql/storage/store_sequence.c
--- a/sql/storage/store_sequence.c
+++ b/sql/storage/store_sequence.c
@@ -9,7 +9,6 @@
 #include "monetdb_config.h"
 #include "store_sequence.h"
 #include "sql_storage.h"
-#include "gdk_logger.h"
 
 typedef struct store_sequence {
        sqlid seqid;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to