Commit eccef981 authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb: Provide invalid Oid value

Since 0 is valid Oid that is used for root database object, zero Oid
value cannot be used as invalid oid. -> Provide explicit invalid Oid
constant.

For symmetry do similarly to Tid, even though zero Tid value is invalid Tid.
parent 3ffbe8d1
...@@ -79,14 +79,17 @@ import ( ...@@ -79,14 +79,17 @@ import (
// by all cumulated transaction changes from database beginning up to, and // by all cumulated transaction changes from database beginning up to, and
// including, transaction specified by tid. // including, transaction specified by tid.
// //
// 0 is invalid Tid. // 0 is invalid Tid, but canonical invalid Tid value is InvalidTid.
type Tid uint64 type Tid uint64
// ZODB/py defines maxtid to be max signed int64 since Jun 7 2016: // ZODB/py defines maxtid to be max signed int64 since Jun 7 2016:
// https://github.com/zopefoundation/ZODB/commit/baee84a6 // https://github.com/zopefoundation/ZODB/commit/baee84a6
// (same in neo/py with "SQLite does not accept numbers above 2^63-1" comment) // (same in neo/py with "SQLite does not accept numbers above 2^63-1" comment)
const TidMax Tid = 1<<63 - 1 // 0x7fffffffffffffff const (
TidMax Tid = 1<<63 - 1 // 0x7fffffffffffffff
InvalidTid Tid = 1<<64 - 1 // 0xffffffffffffffff
)
// Oid is object identifier. // Oid is object identifier.
// //
...@@ -96,10 +99,13 @@ const TidMax Tid = 1<<63 - 1 // 0x7fffffffffffffff ...@@ -96,10 +99,13 @@ const TidMax Tid = 1<<63 - 1 // 0x7fffffffffffffff
// uniquely addresses corresponding data record. // uniquely addresses corresponding data record.
// //
// 0 is valid Oid and represents root database object. // 0 is valid Oid and represents root database object.
// InvalidOid represents an invalid Oid.
// //
// See also: Xid. // See also: Xid.
type Oid uint64 type Oid uint64
const InvalidOid Oid = 1<<64 - 1 // 0xffffffffffffffff
// Xid is "extended" oid - that fully specifies object and query for its revision. // Xid is "extended" oid - that fully specifies object and query for its revision.
// //
// At specifies whole database state at which object identified with Oid should // At specifies whole database state at which object identified with Oid should
......
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