Commit 8732edd6 authored by Kirill Smelkov's avatar Kirill Smelkov

X Sync proto.go after merge

parent b0734a4c
...@@ -14,7 +14,7 @@ import ( ...@@ -14,7 +14,7 @@ import (
) )
const ( const (
PROTOCOL_VERSION = 9 PROTOCOL_VERSION = 12
MIN_PACKET_SIZE = 10 // XXX unsafe.Sizeof(PktHead{}) give _typed_ constant (uintptr) MIN_PACKET_SIZE = 10 // XXX unsafe.Sizeof(PktHead{}) give _typed_ constant (uintptr)
PktHeadLen = MIN_PACKET_SIZE // TODO link this to PktHead.Encode/Decode size ? XXX -> pkt.go ? PktHeadLen = MIN_PACKET_SIZE // TODO link this to PktHead.Encode/Decode size ? XXX -> pkt.go ?
...@@ -32,11 +32,12 @@ const ( ...@@ -32,11 +32,12 @@ const (
OID_DOES_NOT_EXIST OID_DOES_NOT_EXIST
PROTOCOL_ERROR PROTOCOL_ERROR
BROKEN_NODE BROKEN_NODE
ALREADY_PENDING
REPLICATION_ERROR REPLICATION_ERROR
CHECKING_ERROR CHECKING_ERROR
BACKEND_NOT_IMPLEMENTED BACKEND_NOT_IMPLEMENTED
NON_READABLE_CELL
READ_ONLY_ACCESS READ_ONLY_ACCESS
INCOMPLETE_TRANSACTION
) )
type ClusterState int32 type ClusterState int32
...@@ -80,13 +81,6 @@ const ( ...@@ -80,13 +81,6 @@ const (
CORRUPTED //short: C CORRUPTED //short: C
) )
type LockState int32
const (
NOT_LOCKED LockState = iota
GRANTED
GRANTED_TO_OTHER
)
// An UUID (node identifier, 4-bytes signed integer) // An UUID (node identifier, 4-bytes signed integer)
type UUID int32 type UUID int32
...@@ -342,6 +336,9 @@ type StopOperation struct { ...@@ -342,6 +336,9 @@ type StopOperation struct {
// Ask unfinished transactions S -> PM. // Ask unfinished transactions S -> PM.
// Answer unfinished transactions PM -> S. // Answer unfinished transactions PM -> S.
type UnfinishedTransactions struct { type UnfinishedTransactions struct {
RowList []struct{
Offset uint32 // PNumber
}
} }
type AnswerUnfinishedTransactions struct { type AnswerUnfinishedTransactions struct {
...@@ -386,6 +383,16 @@ type AnswerBeginTransaction struct { ...@@ -386,6 +383,16 @@ type AnswerBeginTransaction struct {
Tid zodb.Tid Tid zodb.Tid
} }
// Report storage nodes for which vote failed. C -> M
// True is returned if it's still possible to finish the transaction.
type FailedVote struct {
Tid zodb.Tid
UUIDList []UUID
// XXX _answer = Error
}
// Finish a transaction. C -> PM. // Finish a transaction. C -> PM.
// Answer when a transaction is finished. PM -> C. // Answer when a transaction is finished. PM -> C.
type FinishTransaction struct { type FinishTransaction struct {
...@@ -442,12 +449,43 @@ type AnswerGenerateOIDs struct { ...@@ -442,12 +449,43 @@ type AnswerGenerateOIDs struct {
} }
// Ask master to generate a new TTID that will be used by the client
// to rebase a transaction. S -> PM -> C
type Deadlock struct {
TTid zodb.Tid
LockingTid zodb.Tid
}
// Rebase transaction. C -> S.
type RebaseTransaction struct {
TTid zodb.Tid
LockingTid zodb.Tid
}
type AnswerRebaseTransaction struct {
OidList []zodb.Oid
}
// Rebase object. C -> S.
type RebaseObject struct {
TTid zodb.Tid
Oid zodb.Oid
}
type AnswerRebaseObject struct {
// FIXME POption('conflict')
Serial zodb.Tid
ConflictSerial zodb.Tid
// FIXME POption('data')
Compression bool
Checksum Checksum
Data []byte // XXX was string
}
// Ask to store an object. Send an OID, an original serial, a current // Ask to store an object. Send an OID, an original serial, a current
// transaction ID, and data. C -> S. // transaction ID, and data. C -> S.
// Answer if an object has been stored. If an object is in conflict, // As for IStorage, 'serial' is ZERO_TID for new objects.
// a serial of the conflicting transaction is returned. In this case,
// if this serial is newer than the current transaction ID, a client
// node must not try to resolve the conflict. S -> C.
type StoreObject struct { type StoreObject struct {
Oid zodb.Oid Oid zodb.Oid
Serial zodb.Tid Serial zodb.Tid
...@@ -456,18 +494,16 @@ type StoreObject struct { ...@@ -456,18 +494,16 @@ type StoreObject struct {
Data []byte // TODO separately (for writev) Data []byte // TODO separately (for writev)
DataSerial zodb.Tid DataSerial zodb.Tid
Tid zodb.Tid Tid zodb.Tid
Unlock bool
} }
type AnswerStoreObject struct { type AnswerStoreObject struct {
Conflicting bool Conflict zodb.Tid
Oid zodb.Oid
Serial zodb.Tid
} }
// Abort a transaction. C -> S, PM. // Abort a transaction. C -> S and C -> PM -> S.
type AbortTransaction struct { type AbortTransaction struct {
Tid zodb.Tid Tid zodb.Tid
UUIDList []UUID // unused for * -> S
} }
// Ask to store a transaction. C -> S. // Ask to store a transaction. C -> S.
...@@ -618,6 +654,7 @@ type TweakPartitionTable struct { ...@@ -618,6 +654,7 @@ type TweakPartitionTable struct {
// Notify information about one or more nodes. PM -> Any. // Notify information about one or more nodes. PM -> Any.
type NotifyNodeInformation struct { type NotifyNodeInformation struct {
IdTimestamp float64
NodeList []NodeInfo NodeList []NodeInfo
} }
...@@ -694,19 +731,6 @@ type AnswerObjectUndoSerial struct { ...@@ -694,19 +731,6 @@ type AnswerObjectUndoSerial struct {
} }
} }
// Ask a storage if oid is locked by another transaction.
// C -> S
// Answer whether a transaction holds the write lock for requested object.
type HasLock struct {
Tid zodb.Tid
Oid zodb.Oid
}
type AnswerHasLock struct {
Oid zodb.Oid
LockState LockState
}
// Verifies if given serial is current for object oid in the database, and // Verifies if given serial is current for object oid in the database, and
// take a write lock on it (so that this state is not altered until // take a write lock on it (so that this state is not altered until
...@@ -716,17 +740,16 @@ type AnswerHasLock struct { ...@@ -716,17 +740,16 @@ type AnswerHasLock struct {
// is nothing to invalidate in any client's cache. // is nothing to invalidate in any client's cache.
type CheckCurrentSerial struct { type CheckCurrentSerial struct {
Tid zodb.Tid Tid zodb.Tid
Serial zodb.Tid
Oid zodb.Oid
}
// XXX answer_store_object ?
type AnswerCheckCurrentSerial struct {
Conflicting bool
Oid zodb.Oid Oid zodb.Oid
Serial zodb.Tid Serial zodb.Tid
} }
// XXX answer_store_object ? (was _answer = StoreObject._answer in py)
type AnswerCheckCurrentSerial AnswerStoreObject
//type AnswerCheckCurrentSerial struct {
// Conflict bool
//}
// Request a pack at given TID. // Request a pack at given TID.
// C -> M // C -> M
// M -> S // M -> S
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment