Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
9f0738e5
Commit
9f0738e5
authored
Apr 21, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0e825b2f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
123 additions
and
18 deletions
+123
-18
t/neo/storage/fs1/url.go
t/neo/storage/fs1/url.go
+36
-0
t/neo/zodb/cmd/zodb/.gitignore
t/neo/zodb/cmd/zodb/.gitignore
+1
-0
t/neo/zodb/cmd/zodb/zodb.go
t/neo/zodb/cmd/zodb/zodb.go
+2
-1
t/neo/zodb/open.go
t/neo/zodb/open.go
+50
-0
t/neo/zodb/wks/wks.go
t/neo/zodb/wks/wks.go
+28
-0
t/neo/zodb/zodb.go
t/neo/zodb/zodb.go
+0
-8
t/neo/zodb/zodbtools/.gitignore
t/neo/zodb/zodbtools/.gitignore
+0
-1
t/neo/zodb/zodbtools/command.go
t/neo/zodb/zodbtools/command.go
+1
-3
t/neo/zodb/zodbtools/dump.go
t/neo/zodb/zodbtools/dump.go
+1
-2
t/neo/zodb/zodbtools/dump_test.go
t/neo/zodb/zodbtools/dump_test.go
+2
-2
t/neo/zodb/zodbtools/info.go
t/neo/zodb/zodbtools/info.go
+2
-1
No files found.
t/neo/storage/fs1/url.go
0 → 100644
View file @
9f0738e5
// Copyright (C) 2017 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
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
package
fs1
// URL support
import
(
"net/url"
"../../zodb"
)
// TODO read-only support
func
openByURL
(
u
*
url
.
URL
)
(
zodb
.
IStorage
,
error
)
{
// TODO handle query
// XXX u.Path is not always raw path - recheck and fix
return
Open
(
u
.
Path
)
}
func
init
()
{
zodb
.
RegisterStorage
(
"file://"
,
openByURL
)
}
t/neo/zodb/cmd/zodb/.gitignore
0 → 100644
View file @
9f0738e5
/zodb
t/neo/zodb/cmd/zodb/zodb.go
View file @
9f0738e5
...
@@ -24,8 +24,9 @@ import (
...
@@ -24,8 +24,9 @@ import (
"os"
"os"
"../../zodbtools"
"../../zodbtools"
)
_
"../../../zodb/wks"
)
func
usage
()
{
func
usage
()
{
w
:=
os
.
Stderr
w
:=
os
.
Stderr
...
...
t/neo/zodb/open.go
0 → 100644
View file @
9f0738e5
// Copyright (C) 2017 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
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
package
zodb
// logic to open storages by URL
import
(
"net/url"
"strings"
)
// OpenStorage opens ZODB storage by URL
// Only URL schemes registered to zodb package are handled.
// Users should user import in storage packages they use or zodb/wks package to
// get support work well-known storages.
// Storage authors should register their storages with RegisterStorage
//
// TODO readonly
func
OpenStorageURL
(
storageURL
string
)
(
IStorage
,
error
)
{
// no scheme -> file://
if
!
strings
.
Contains
(
storageURL
,
"://"
)
{
storageURL
=
"file://"
+
storageURL
}
return
nil
,
nil
}
// StorageOpener is a function to open a storage
type
StorageOpener
func
(
u
*
url
.
URL
)
(
IStorage
,
error
)
// RegisterStorage registers handler to be used for URLs with scheme
func
RegisterStorage
(
scheme
string
,
handler
StorageOpener
)
{
// TODO
}
t/neo/zodb/wks/wks.go
0 → 100644
View file @
9f0738e5
// Copyright (C) 2017 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
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// Package wks links-in well-known ZODB storages
// The only purpose of this package is so that users import it
//
// import _ ".../zodb/wks" XXX fixme import path
//
// and this way automatically link in support for file:// neo:// ... storages.
package
wks
import
(
_
"../../storage/fs1"
)
t/neo/zodb/zodb.go
View file @
9f0738e5
...
@@ -158,11 +158,3 @@ type IStorageRecordIterator interface { // XXX naming -> IRecordIterator
...
@@ -158,11 +158,3 @@ type IStorageRecordIterator interface { // XXX naming -> IRecordIterator
// end of iteration is indicated with io.EOF
// end of iteration is indicated with io.EOF
NextData
()
(
*
StorageRecordInformation
,
error
)
NextData
()
(
*
StorageRecordInformation
,
error
)
}
}
// TODO readonly
func
Open
(
storageURL
string
)
(
IStorage
,
error
)
{
// TODO
return
nil
,
nil
}
t/neo/zodb/zodbtools/.gitignore
deleted
100644 → 0
View file @
0e825b2f
/zodbdump
t/neo/zodb/zodbtools/command.go
View file @
9f0738e5
...
@@ -18,9 +18,7 @@
...
@@ -18,9 +18,7 @@
package
zodbtools
package
zodbtools
// registry for all commands
// registry for all commands
import
(
import
"io"
"io"
)
// Command describes one zodb subcommand
// Command describes one zodb subcommand
type
Command
struct
{
type
Command
struct
{
...
...
t/neo/zodb/zodbtools/dump.go
View file @
9f0738e5
...
@@ -47,7 +47,6 @@ import (
...
@@ -47,7 +47,6 @@ import (
"lab.nexedi.com/kirr/go123/xfmt"
"lab.nexedi.com/kirr/go123/xfmt"
"../../zodb"
"../../zodb"
// "../../storage/fs1"
)
)
...
@@ -246,7 +245,7 @@ func dumpMain(argv []string) {
...
@@ -246,7 +245,7 @@ func dumpMain(argv []string) {
log
.
Fatal
(
err
)
// XXX recheck
log
.
Fatal
(
err
)
// XXX recheck
}
}
stor
,
err
:=
zodb
.
Open
(
storUrl
)
// TODO read-only
stor
,
err
:=
zodb
.
Open
StorageURL
(
storUrl
)
// TODO read-only
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
...
...
t/neo/zodb/zodbtools/dump_test.go
View file @
9f0738e5
...
@@ -86,7 +86,7 @@ func TestZodbDump(t *testing.T) {
...
@@ -86,7 +86,7 @@ func TestZodbDump(t *testing.T) {
withTestdata1Fs
(
t
,
func
(
fs
*
fs1
.
FileStorage
)
{
withTestdata1Fs
(
t
,
func
(
fs
*
fs1
.
FileStorage
)
{
buf
:=
bytes
.
Buffer
{}
buf
:=
bytes
.
Buffer
{}
err
:=
zodb
Dump
(
&
buf
,
fs
,
0
,
zodb
.
TidMax
,
false
)
err
:=
Dump
(
&
buf
,
fs
,
0
,
zodb
.
TidMax
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -106,7 +106,7 @@ func BenchmarkZodbDump(b *testing.B) {
...
@@ -106,7 +106,7 @@ func BenchmarkZodbDump(b *testing.B) {
b
.
ResetTimer
()
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
err
:=
zodb
Dump
(
ioutil
.
Discard
,
fs
,
0
,
zodb
.
TidMax
,
false
)
err
:=
Dump
(
ioutil
.
Discard
,
fs
,
0
,
zodb
.
TidMax
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
b
.
Fatal
(
err
)
b
.
Fatal
(
err
)
}
}
...
...
t/neo/zodb/zodbtools/info.go
View file @
9f0738e5
...
@@ -35,6 +35,7 @@ type paramFunc func(stor zodb.IStorage) (string, error)
...
@@ -35,6 +35,7 @@ type paramFunc func(stor zodb.IStorage) (string, error)
var
infov
=
[]
struct
{
name
string
;
getParam
paramFunc
}
{
var
infov
=
[]
struct
{
name
string
;
getParam
paramFunc
}
{
// XXX e.g. stor.LastTid() should return err itself
// XXX e.g. stor.LastTid() should return err itself
{
"name"
,
func
(
stor
zodb
.
IStorage
)
(
string
,
error
)
{
return
stor
.
StorageName
(),
nil
}},
{
"name"
,
func
(
stor
zodb
.
IStorage
)
(
string
,
error
)
{
return
stor
.
StorageName
(),
nil
}},
// TODO reenable size
// {"size", func(stor zodb.IStorage) (string, error) { return stor.StorageSize(), nil }},
// {"size", func(stor zodb.IStorage) (string, error) { return stor.StorageSize(), nil }},
{
"last_tid"
,
func
(
stor
zodb
.
IStorage
)
(
string
,
error
)
{
return
stor
.
LastTid
()
.
String
(),
nil
}},
{
"last_tid"
,
func
(
stor
zodb
.
IStorage
)
(
string
,
error
)
{
return
stor
.
LastTid
()
.
String
(),
nil
}},
}
}
...
@@ -112,7 +113,7 @@ func infoMain(argv []string) {
...
@@ -112,7 +113,7 @@ func infoMain(argv []string) {
}
}
storUrl
:=
argv
[
0
]
storUrl
:=
argv
[
0
]
stor
,
err
:=
zodb
.
Open
(
storUrl
)
// TODO read-only
stor
,
err
:=
zodb
.
Open
StorageURL
(
storUrl
)
// TODO read-only
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment