added flow support for Connector.js

This commit is contained in:
Kevin Jahns
2015-11-30 12:26:02 +01:00
parent bd9c3813fd
commit da2762edf5
5 changed files with 82 additions and 27 deletions

View File

@@ -12,6 +12,7 @@ type Struct = {
struct: 'Insert' | 'Delete'
}*/
type Struct = Insertion | Deletion
type Operation = Struct
type Insertion = {
id: Id,
@@ -23,4 +24,30 @@ type Insertion = {
type Deletion = {
target: Id,
struct: 'Delete'
}
}
type MessageSyncStep1 = {
type: 'sync step 1',
deleteSet: any,
stateSet: any
}
type MessageSyncStep2 = {
type: 'sync step 2',
os: Array<Operation>,
deleteSet: any,
stateSet: any
}
type MessageUpdate = {
type: 'update',
ops: Array<Operation>
}
type MessageSyncDone = {
type: 'sync done'
}
type Message = MessageSyncStep1 | MessageSyncStep2 | MessageUpdate | MessageSyncDone

View File

@@ -4,9 +4,10 @@ type YGlobal = {
utils: Object;
Struct: Object;
AbstractDatabase: any;
AbstractConnector: any;
}
type YInstance = {
type YConfig = {
db: Object,
connector: Object,
root: Object
@@ -14,4 +15,6 @@ type YInstance = {
declare var YConcurrency_TestingMode : boolean
type Transaction<A> = Generator<any, A, any>
type Transaction<A> = Generator<any, A, any>
type SyncRole = 'master' | 'slave'