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

.

parent 26f53db1
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
# Copyright (C) 2017-2018 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# 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
......
......@@ -106,6 +106,7 @@ func normPyClass(xklass interface{}) (pickle.Class, error) {
if len(t) != 2 {
return pickle.Class{}, errInvalidPyClass
}
// XXX newargs is ignored (zodb/py uses it only for persistent classes)
xklass = t[0]
if t, ok := xklass.(pickle.Tuple); ok {
// t = (modname, classname)
......
......@@ -30,6 +30,8 @@ type _PyDataClassName_TestEntry struct {
className string
}
// XXX + test with zodbpickle.binary (see 12ee41c4 in ZODB)
func TestPyClassName(t *testing.T) {
for _, tt := range _PyData_ClassName_Testv {
className := PyData(tt.pydata).ClassName()
......@@ -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 {
call, ok := targ[1].(pickle.Call)
if !ok {
// 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
......
......@@ -271,7 +271,7 @@ func (zl *zLink) _call(ctx context.Context, method string, argv ...interface{})
// ---- raw IO ----
// pktBuf is buffer for preparing outgoing packet.
// pktBuf is buffer with packet data.
//
// alloc via allocPkb and free via pkb.Free.
// similar to skb in Linux.
......
......@@ -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 {
// the same as _parseRaw in TimeStamp/py
// https://github.com/zopefoundation/persistent/blob/aba23595/persistent/timestamp.py#L75
......
......@@ -23,6 +23,30 @@
// Data model this package provides is partly based on ZODB/py
// (https://github.com/zopefoundation/ZODB) to maintain compatibility in
// 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
import (
......@@ -106,7 +130,7 @@ type DataInfo struct {
DataTidHint Tid
}
// TxnStatus represents status of a transaction
// TxnStatus represents status of a transaction.
type TxnStatus byte
const (
......@@ -118,7 +142,7 @@ const (
// ---- 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 {
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