3 * Copyright (C)2007-2008 Versabanq Innovations Inc. and contributors.
4 * See the included file named LICENSE for license information.
7 using System
.Collections
.Generic
;
9 // An interface to a Schemamatic schema backend.
10 internal interface ISchemaBackend
: IDisposable
12 // Update the backing store with all current elements.
13 // If an element's text is empty, it will be deleted.
14 VxSchemaErrors
Put(VxSchema schema
, VxSchemaChecksums sums
, VxPutOpts opts
);
16 // Get elements from the backing store.
17 // If keys is non-empty, only returns the schema for listed keys.
18 // If keys is empty, returns all schema elements.
19 VxSchema
Get(IEnumerable
<string> keys
);
21 // Gets the checksums for all elements from the backing store.
22 VxSchemaChecksums
GetChecksums();
24 // Removes the given elements from the schema.
25 VxSchemaErrors
DropSchema(IEnumerable
<string> keys
);
27 // Returns a blob of text that can be used with PutSchemaData to fill
29 // "seqnum" provides a hint about the priority of the table when batch
30 // processing, and is used to locate the file on disk.
31 // "where" is the body of a SQL "WHERE" clause, to limit the data
32 // returned by the database, if applicable.
33 // "replaces" is the list of replacements to be made on a field
34 // "skipfields" is the list of fields to skip during export
35 string GetSchemaData(string tablename
, int seqnum
, string where
,
36 Dictionary
<string,string> replaces
,
37 List
<string> skipfields
);
39 // Delete all rows from the given table and replace them with the given
40 // data. text is an opaque hunk of text returned from GetSchemaData.
41 // Seqnum provides a hint about the priority of the table when batch
42 // processing, and is used to locate the file on disk.
43 void PutSchemaData(string tablename
, string text
, int seqnum
);
47 public enum VxPutOpts
: int
50 // If set, PutSchema will do potentially destructive things like
51 // dropping a table in order to re-add it.
53 // If set, PutSchema will not attempt to do any retries.
55 // If set and the element already exists, will create the new element
56 // with a different name that doesn't already exist.
57 // Currently only applies to the disk backend; other backends ignore this.