Commit 71e5833a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 26f53db1
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2017 Nexedi SA and Contributors. # Copyright (C) 2017-2018 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your # it under the terms of the GNU General Public License version 3, or (at your
......
...@@ -106,6 +106,7 @@ func normPyClass(xklass interface{}) (pickle.Class, error) { ...@@ -106,6 +106,7 @@ func normPyClass(xklass interface{}) (pickle.Class, error) {
if len(t) != 2 { if len(t) != 2 {
return pickle.Class{}, errInvalidPyClass return pickle.Class{}, errInvalidPyClass
} }
// XXX newargs is ignored (zodb/py uses it only for persistent classes)
xklass = t[0] xklass = t[0]
if t, ok := xklass.(pickle.Tuple); ok { if t, ok := xklass.(pickle.Tuple); ok {
// t = (modname, classname) // t = (modname, classname)
......
...@@ -30,6 +30,8 @@ type _PyDataClassName_TestEntry struct { ...@@ -30,6 +30,8 @@ type _PyDataClassName_TestEntry struct {
className string className string
} }
// XXX + test with zodbpickle.binary (see 12ee41c4 in ZODB)
func TestPyClassName(t *testing.T) { func TestPyClassName(t *testing.T) {
for _, tt := range _PyData_ClassName_Testv { for _, tt := range _PyData_ClassName_Testv {
className := PyData(tt.pydata).ClassName() className := PyData(tt.pydata).ClassName()
...@@ -39,3 +41,7 @@ func TestPyClassName(t *testing.T) { ...@@ -39,3 +41,7 @@ func TestPyClassName(t *testing.T) {
} }
} }
} }
func TestPyDecode(t *testing.T) {
// XXX
}
...@@ -234,7 +234,7 @@ func (r rpc) zeo4Error(arg interface{}) error { ...@@ -234,7 +234,7 @@ func (r rpc) zeo4Error(arg interface{}) error {
call, ok := targ[1].(pickle.Call) call, ok := targ[1].(pickle.Call)
if !ok { if !ok {
// not a call - the best we can do is to guess // not a call - the best we can do is to guess
return r.ereplyf("excep4: %s: inst %#v; expect call", exc, targ[1:]) return r.ereplyf("except4: %s: inst %#v; expect call", exc, targ[1:])
} }
exc = call.Callable.Module + "." + call.Callable.Name exc = call.Callable.Module + "." + call.Callable.Name
......
...@@ -271,7 +271,7 @@ func (zl *zLink) _call(ctx context.Context, method string, argv ...interface{}) ...@@ -271,7 +271,7 @@ func (zl *zLink) _call(ctx context.Context, method string, argv ...interface{})
// ---- raw IO ---- // ---- raw IO ----
// pktBuf is buffer for preparing outgoing packet. // pktBuf is buffer with packet data.
// //
// alloc via allocPkb and free via pkb.Free. // alloc via allocPkb and free via pkb.Free.
// similar to skb in Linux. // similar to skb in Linux.
......
...@@ -41,7 +41,7 @@ func (t TimeStamp) XFmtString(b []byte) []byte { ...@@ -41,7 +41,7 @@ func (t TimeStamp) XFmtString(b []byte) []byte {
} }
// Time converts tid to time // Time converts tid to time.
func (tid Tid) Time() TimeStamp { func (tid Tid) Time() TimeStamp {
// the same as _parseRaw in TimeStamp/py // the same as _parseRaw in TimeStamp/py
// https://github.com/zopefoundation/persistent/blob/aba23595/persistent/timestamp.py#L75 // https://github.com/zopefoundation/persistent/blob/aba23595/persistent/timestamp.py#L75
......
...@@ -23,6 +23,30 @@ ...@@ -23,6 +23,30 @@
// Data model this package provides is partly based on ZODB/py // Data model this package provides is partly based on ZODB/py
// (https://github.com/zopefoundation/ZODB) to maintain compatibility in // (https://github.com/zopefoundation/ZODB) to maintain compatibility in
// between Python and Go implementations. // between Python and Go implementations.
//
// Data model
//
// Tid, Oid, ? Xid.
//
//
// Operation
//
// Load(oid, at), iteration.
// OpenStorage
//
//
// Python data
//
// PyData, PyObject, ...
//
//
// Storage drivers
//
// IStorageDriver, RegisterDriver + wks (FileStorage, ZEO and NEO).
//
// ----
//
// XXX link to zodbtools / `zodb` cmd?
package zodb package zodb
import ( import (
...@@ -106,7 +130,7 @@ type DataInfo struct { ...@@ -106,7 +130,7 @@ type DataInfo struct {
DataTidHint Tid DataTidHint Tid
} }
// TxnStatus represents status of a transaction // TxnStatus represents status of a transaction.
type TxnStatus byte type TxnStatus byte
const ( const (
...@@ -118,7 +142,7 @@ const ( ...@@ -118,7 +142,7 @@ const (
// ---- interfaces ---- // ---- interfaces ----
// NoObjectError is the error which tells that there is no such object in the database at all // NoObjectError is the error which tells that there is no such object in the database at all.
type NoObjectError struct { type NoObjectError struct {
Oid Oid Oid Oid
} }
......
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