Commit 9206bfb6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 686b8976
...@@ -344,7 +344,6 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) { ...@@ -344,7 +344,6 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) {
return nil, fmt.Errorf("NEO/go POC: not ready to handle: %s", err) return nil, fmt.Errorf("NEO/go POC: not ready to handle: %s", err)
} }
// config("version") // config("version")
// config("nid") // config("nid")
// config("partitions") // config("partitions")
...@@ -355,6 +354,22 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) { ...@@ -355,6 +354,22 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) {
// config("truncate_tid") // config("truncate_tid")
// config("_pack_tid") // config("_pack_tid")
// check ttrans/tobj to be empty - else there are some unfinished, or
// not-yet-moved to trans/tobj transactions.
nttrans, ntobj := 0, 0
errv = xerr.Errorv{}
errv.Appendif( b.query1(ctx, "SELECT COUNT(*) FROM ttrans") .Scan(&nttrans) )
errv.Appendif( b.query1(ctx, "SELECT COUNT(*) FROM tobj") .Scan(&ntobj) )
err = errv.Err()
if err != nil {
return nil, fmt.Errorf("NEO/go POC: checking ttrans/tobj: %s", err)
}
if !(nttrans==0 && ntobj==0) {
return nil, fmt.Errorf("NEO/go POC: not ready to handle: !empty ttrans/tobj")
}
return b, nil return b, nil
} }
......
...@@ -185,7 +185,7 @@ loop: ...@@ -185,7 +185,7 @@ loop:
h.Write(buf.Data) h.Write(buf.Data)
//fmt.Fprintf(os.Stderr, "%d @%s\tsha1: %x\n", uint(oid), serial, h.Sum(nil)) //fmt.Fprintf(os.Stderr, "%d @%s\t%s: %x\n", uint(oid), serial, h.name, h.Sum(nil))
//fmt.Fprintf(os.Stderr, "\tdata: %x\n", buf.Data) //fmt.Fprintf(os.Stderr, "\tdata: %x\n", buf.Data)
nread += len(buf.Data) nread += len(buf.Data)
......
...@@ -54,7 +54,7 @@ class Adler32Hasher: ...@@ -54,7 +54,7 @@ class Adler32Hasher:
self.h = adler32(data, self.h) self.h = adler32(data, self.h)
def hexdigest(self): def hexdigest(self):
return '%x' % (self.h & 0xffffffff) return '%08x' % (self.h & 0xffffffff)
# crc32 in hashlib interface # crc32 in hashlib interface
class CRC32Hasher: class CRC32Hasher:
...@@ -67,7 +67,7 @@ class CRC32Hasher: ...@@ -67,7 +67,7 @@ class CRC32Hasher:
self.h = crc32(data, self.h) self.h = crc32(data, self.h)
def hexdigest(self): def hexdigest(self):
return '%x' % (self.h & 0xffffffff) return '%08x' % (self.h & 0xffffffff)
# {} name -> hasher # {} name -> hasher
hashRegistry = { hashRegistry = {
...@@ -152,7 +152,7 @@ def main(): ...@@ -152,7 +152,7 @@ def main():
h.update(data) h.update(data)
#print('%s @%s\tsha1: %s' % (oid, u64(serial), h.hexdigest()), file=sys.stderr) #print('%s @%s\t%s: %s' % (oid, u64(serial), h.name, h.hexdigest()), file=sys.stderr)
#print('\tdata: %s' % (data.encode('hex'),), file=sys.stderr) #print('\tdata: %s' % (data.encode('hex'),), file=sys.stderr)
nread += len(data) nread += len(data)
......
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