DeveelDB
20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
deveeldb.git
src
deveeldb
Deveel.Data.Sql.Tables
VersionedTableIndexList.cs
Go to the documentation of this file.
1
//
2
// Copyright 2010-2015 Deveel
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
//
16
17
using
System
;
18
using
System
.Collections.Generic;
19
using
System
.Linq;
20
21
using
Deveel
.
Data
.
Sql
;
22
23
namespace
Deveel
.Data.Sql.Tables {
24
class
VersionedTableIndexList
{
25
private
readonly List<TableEventRegistry>
eventRegistries
;
26
27
public
VersionedTableIndexList
(
TableSource
tableSource) {
28
TableSource
= tableSource;
29
30
eventRegistries =
new
List<TableEventRegistry>();
31
}
32
33
public
IDatabaseContext
DatabaseContext
{
34
get
{
return
TableSource
.
DatabaseContext
; }
35
}
36
37
public
TableSource
TableSource
{
get
;
private
set; }
38
39
public
bool
HasChangesPending {
40
get
{
return
eventRegistries.Any(); }
41
}
42
43
public
void
AddRegistry
(
TableEventRegistry
registry) {
44
eventRegistries.Add(registry);
45
}
46
47
public
bool
MergeChanges
(
long
commitId) {
48
// TODO: report the stat to the system
49
50
while
(eventRegistries.Count > 0) {
51
var registry = eventRegistries[0];
52
53
if
(commitId > registry.CommitId) {
54
// Remove the top registry from the list.
55
eventRegistries.RemoveAt(0);
56
}
else
{
57
return
false
;
58
}
59
}
60
61
return
true
;
62
}
63
64
public
IEnumerable<TableEventRegistry>
FindSinceCommit
(
long
commitId) {
65
return
eventRegistries.Where(x => x.CommitId >= commitId);
66
}
67
}
68
}
Deveel.Data.Sql.Tables.VersionedTableIndexList.VersionedTableIndexList
VersionedTableIndexList(TableSource tableSource)
Definition:
VersionedTableIndexList.cs:27
Deveel
Deveel.Data.Sql.Tables.VersionedTableIndexList.AddRegistry
void AddRegistry(TableEventRegistry registry)
Definition:
VersionedTableIndexList.cs:43
System
Definition:
NonSerializedAttribute.cs:3
Deveel.Data.IDatabaseContext
The context of a single database within a system.
Definition:
IDatabaseContext.cs:32
Deveel.Data.Sql.Tables.TableSource
Definition:
TableSource.cs:34
Deveel.Data.TableEventRegistry
Definition:
TableEventRegistry.cs:27
Deveel.Data
Definition:
ActiveSessionList.cs:22
Deveel.Data.DatabaseContext
Definition:
DatabaseContext.cs:25
Deveel.Data.Sql.Tables.VersionedTableIndexList.eventRegistries
readonly List< TableEventRegistry > eventRegistries
Definition:
VersionedTableIndexList.cs:25
Deveel.Data.Sql.Tables.TableSource.DatabaseContext
IDatabaseContext DatabaseContext
Definition:
TableSource.cs:69
Deveel.Data.Sql.Tables.VersionedTableIndexList.MergeChanges
bool MergeChanges(long commitId)
Definition:
VersionedTableIndexList.cs:47
Deveel.Data.Sql
Definition:
CellId.cs:22
Deveel.Data.Sql.Tables.VersionedTableIndexList.FindSinceCommit
IEnumerable< TableEventRegistry > FindSinceCommit(long commitId)
Definition:
VersionedTableIndexList.cs:64
Deveel.Data.Sql.Tables.VersionedTableIndexList
Definition:
VersionedTableIndexList.cs:24
Generated by
1.8.10