| 1 | /* |
| 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | * |
| 6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | #ifndef BATSTORAGE_H |
| 10 | #define BATSTORAGE_H |
| 11 | |
| 12 | #include "sql_storage.h" |
| 13 | #include "bat_logger.h" |
| 14 | |
| 15 | typedef struct sql_delta { |
| 16 | char *name; /* name of the main bat */ |
| 17 | int bid; |
| 18 | oid ibase; /* ibase: first id of inserts */ |
| 19 | int ibid; /* bat with inserts */ |
| 20 | int uibid; /* bat with positions of updates */ |
| 21 | int uvbid; /* bat with values of updates */ |
| 22 | int cleared; |
| 23 | size_t cnt; /* number of tuples (excluding the deletes) */ |
| 24 | size_t ucnt; /* number of updates */ |
| 25 | BAT *cached; /* cached copy, used for schema bats only */ |
| 26 | int wtime; /* time stamp */ |
| 27 | struct sql_delta *next; /* possibly older version of the same column/idx */ |
| 28 | } sql_delta; |
| 29 | |
| 30 | typedef struct sql_dbat { |
| 31 | char *dname; /* name of the persistent deletes bat */ |
| 32 | int dbid; /* bat with deletes */ |
| 33 | int cleared; |
| 34 | size_t cnt; |
| 35 | BAT *cached; /* cached copy, used for schema bats only */ |
| 36 | int wtime; /* time stamp */ |
| 37 | struct sql_dbat *next; /* possibly older version of the same deletes */ |
| 38 | } sql_dbat; |
| 39 | |
| 40 | /* initialize bat storage call back functions interface */ |
| 41 | extern void bat_storage_init( store_functions *sf ); |
| 42 | |
| 43 | extern int dup_bat(sql_trans *tr, sql_table *t, sql_delta *obat, sql_delta *bat, int type, int oc_isnew, int c_isnew); |
| 44 | extern sql_delta * timestamp_delta( sql_delta *d, int ts); |
| 45 | extern sql_dbat * timestamp_dbat( sql_dbat *d, int ts); |
| 46 | |
| 47 | #endif /*BATSTORAGE_H */ |
| 48 | |
| 49 | |