Add getBytes to conflict_set.py
All checks were successful
Tests / Clang total: 1096, passed: 1096
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / SIMD fallback total: 1096, passed: 1096
Tests / Release [gcc] total: 1096, passed: 1096
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 824, passed: 824
Tests / Coverage total: 823, passed: 823
weaselab/conflict-set/pipeline/head This commit looks good
All checks were successful
Tests / Clang total: 1096, passed: 1096
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / SIMD fallback total: 1096, passed: 1096
Tests / Release [gcc] total: 1096, passed: 1096
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 824, passed: 824
Tests / Coverage total: 823, passed: 823
weaselab/conflict-set/pipeline/head This commit looks good
This commit is contained in:
@@ -58,6 +58,9 @@ _lib.ConflictSet_setOldestVersion.argtypes = (ctypes.c_void_p, ctypes.c_int64)
|
|||||||
|
|
||||||
_lib.ConflictSet_destroy.argtypes = (ctypes.c_void_p,)
|
_lib.ConflictSet_destroy.argtypes = (ctypes.c_void_p,)
|
||||||
|
|
||||||
|
_lib.ConflictSet_getBytes.argtypes = (ctypes.c_void_p,)
|
||||||
|
_lib.ConflictSet_getBytes.restype = ctypes.c_int64
|
||||||
|
|
||||||
|
|
||||||
class Result(enum.Enum):
|
class Result(enum.Enum):
|
||||||
COMMIT = 0
|
COMMIT = 0
|
||||||
@@ -106,6 +109,9 @@ class ConflictSet:
|
|||||||
def setOldestVersion(self, version: int) -> None:
|
def setOldestVersion(self, version: int) -> None:
|
||||||
_lib.ConflictSet_setOldestVersion(self.p, version)
|
_lib.ConflictSet_setOldestVersion(self.p, version)
|
||||||
|
|
||||||
|
def getBytes(self) -> int:
|
||||||
|
return _lib.ConflictSet_getBytes(self.p)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@@ -3,7 +3,10 @@ from conflict_set import *
|
|||||||
|
|
||||||
def test_conflict_set():
|
def test_conflict_set():
|
||||||
with ConflictSet() as cs:
|
with ConflictSet() as cs:
|
||||||
cs.addWrites(1, write(b""))
|
before = cs.getBytes()
|
||||||
assert cs.check(read(0, b"")) == [Result.CONFLICT]
|
key = b"a key"
|
||||||
|
cs.addWrites(1, write(key))
|
||||||
|
assert cs.getBytes() - before > 0
|
||||||
|
assert cs.check(read(0, key)) == [Result.CONFLICT]
|
||||||
cs.setOldestVersion(1)
|
cs.setOldestVersion(1)
|
||||||
assert cs.check(read(0, b"")) == [Result.TOO_OLD]
|
assert cs.check(read(0, key)) == [Result.TOO_OLD]
|
||||||
|
Reference in New Issue
Block a user