Changeset: b86db49eb101 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b86db49eb101
Modified Files:
        sql/src/backends/monet5/vaults/vault.mx
        sql/src/sql/createdb.mx
        sql/src/sql/vault.sql
Branch: default
Log Message:

Fixation of updates to vault


diffs (180 lines):

diff -r 9030e5f32c86 -r b86db49eb101 sql/src/backends/monet5/vaults/vault.mx
--- a/sql/src/backends/monet5/vaults/vault.mx   Mon Jul 05 16:06:37 2010 +0200
+++ b/sql/src/backends/monet5/vaults/vault.mx   Mon Jul 05 21:21:11 2010 +0200
@@ -23,14 +23,15 @@
 @+ Data Vaults
 The Data Vault module provides the basic infrastructure to manage
 a repository with datafiles whose integrity and use is shared between
-MonetDB and a client. The module is developed solely for a Linux environment.
+MonetDB and a client repository.
 
 Once a vault is created, the system administrator can manually add files to 
the catalog.
-A refresh() operation will fetch the files from the remote site.
-If they reside on the same file system then a symbolic link is sufficient.
-Alternatively, the vault can be populated by designation of the
-source directory of the files to be imported. Often, this involves
-semantic knowledge of the target repository and the vault kind.
+A refresh() operation will fetch the files from the remote site using a path
+to an (ftp) directory.
+Often, this involves semantic knowledge of the target repository and the vault 
kind.
+
+If source and target files reside on the same file system then a symbolic link 
is sufficient.
+Alternatively, the vault can be populated using normal updates to the vault 
catalog.
 
 The SQL view on the vault merely describes the files being imported,
 their freshness and properties required to fetch them from a remote source.
@@ -46,20 +47,22 @@
 target                 string                  -- file name of source file in 
vault
 );
 
-create function vaultDir(nme string)
+create function vaultDir()
 returns string
 external "vault.getDirectory";
+...@end verbatim
 
-...@end verbatim
+The module is developed solely for a Linux environment.
 The vault root is a subdirectory of the dbfarm/<dbname>/vault/ and contains
-a subdirectory for each vault kind.
+a subdirectory for each vault kind. In turn, each vault kind comes
+with a refinement of the catalog identified above using the vid
+to relate the two.
 @mal
-library vault;
 module vault;
 
-command getDirectory(i:int):str
+command getdirectory():str
 address VLTgetDirectory
-comment "Return the location of the vault directory";
+comment "Return the location of the root vault directory";
 
 command refresh(id:str)
 address VLTrefresh
@@ -68,6 +71,7 @@
 command refresh(id:int)
 address VLTrefreshObject
 comment "Refresh the content of the vault for a specific object";
+
 pattern prelude():void 
 address VLTprelude
 comment "Initialize the vault.";
@@ -76,6 +80,7 @@
 address VLTepilogue
 comment "Cleanup the vault.";
 
+vault.prelude();
 @{
 @-
 @+ Implementation
@@ -98,6 +103,8 @@
 #define vault_export extern
 #endif
 
+#define _VAULT_DEBUG_
+
 vault_export str VLTprelude(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 vault_export str VLTgetDirectory(str *ret);
 vault_export str VLTrefresh(int *ret, str *nme);
@@ -109,10 +116,19 @@
 #include "vault.h"
 
 static char vaultpath[BUFSIZ];
+...@-
+...@= initialize
+       if ( vaultpath[0] == 0){
+               snprintf(vaultpath, PATHLENGTH, "%s%c%s%cvault", 
GDKgetenv("gdk_dbfarm"), DIR_SEP, GDKgetenv("gdk_dbname"), DIR_SEP);
+               if (mkdir(vaultpath, 0755) < 0 && errno != EEXIST) 
+                       return createException(MAL,"vault.getDirectory", "can 
not access vault directory");
+       }
+...@c
 
 str
 VLTprelude(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
+       @:initialize@
        (void) cntxt;
        (void) mb;
        (void) stk;
@@ -126,31 +142,20 @@
        (void)ret;
        return MAL_SUCCEED;
 }
-...@-
-...@= initialize
-       if ( vaultpath[0] == 0){
-               snprintf(vaultpath, PATHLENGTH, "%s%c%s%cvault", 
GDKgetenv("gdk_dbfarm"), DIR_SEP, GDKgetenv("gdk_dbname"), DIR_SEP);
-               if (mkdir(vaultpath, 0755) < 0 && errno != EEXIST) 
-                       return createException(MAL,"vault.getDirectory", "can 
not access vault directory");
-       }
-...@c
 str 
 VLTgetDirectory(str *ret){
-       @:initialize@
        *ret= GDKstrdup(vaultpath);
        return MAL_SUCCEED;
 }
 
 str 
 VLTrefresh(int *ret, str *nme){
-       @:initialize@
        (void) ret;
        (void) nme;
        return MAL_SUCCEED;
 }
 str 
 VLTrefreshObject(int *ret, int *id){
-       @:initialize@
        (void) ret;
        (void) id;
        return MAL_SUCCEED;
diff -r 9030e5f32c86 -r b86db49eb101 sql/src/sql/createdb.mx
--- a/sql/src/sql/createdb.mx   Mon Jul 05 16:06:37 2010 +0200
+++ b/sql/src/sql/createdb.mx   Mon Jul 05 21:21:11 2010 +0200
@@ -41,8 +41,11 @@
 @include cluster.sql
 
 @include dependency_functions.sql
+...@include clients.sql
+
+-- Scientific database section
 @include skyserver.sql
-...@include clients.sql
+...@include vault.sql
 
 @-
 The remaining functionality is considered for debugging.
diff -r 9030e5f32c86 -r b86db49eb101 sql/src/sql/vault.sql
--- a/sql/src/sql/vault.sql     Mon Jul 05 16:06:37 2010 +0200
+++ b/sql/src/sql/vault.sql     Mon Jul 05 21:21:11 2010 +0200
@@ -15,20 +15,23 @@
 -- All Rights Reserved.
 
 -- The data vault interface for SQL
+
+CREATE SEQUENCE sys.vaultid AS int;
+
 CREATE TABLE sys.vault (
-vid             int PRIMARY KEY,-- Internal key
+vid             int PRIMARY KEY DEFAULT NEXT VALUE FOR sys.vaultid ,
 kind            string,         -- vault kind (CSV, MSEED, FITS,..)
 source          string,         -- remote file name for cURL to access
+target          string,         -- location of source file in the local vault
 refresh         boolean,        -- refresh each time of access
-cached          timestamp,      -- copy stored locally
-target          string          -- file name of source file in vault
+cached          timestamp       -- if a copy was stored locally
 );
 
-create function getVaultDir(nme string)
+create function getVaultDir()
 returns string
-external name sql.getVaultDir;
+external name vault.getDirectory;
 
 -- refresh the vault
 create procedure refreshVault(nme string)
-external name sql.refreshVault;
+external name vault.refresh;
 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to