Commit 077c4651 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e5e5879b
...@@ -101,7 +101,7 @@ func (b *bucketWrap) MaxKey(ctx context.Context) (k int64, ok bool, err error) { ...@@ -101,7 +101,7 @@ func (b *bucketWrap) MaxKey(ctx context.Context) (k int64, ok bool, err error) {
func TestBTree(t *testing.T) { func TestBTree(t *testing.T) {
X := exc.Raiseif X := exc.Raiseif
ctx := context.Background() ctx := context.Background()
stor, err := zodb.OpenStorage(ctx, "testdata/1.fs", &zodb.OpenOptions{ReadOnly: true}) stor, err := zodb.Open(ctx, "testdata/1.fs", &zodb.OpenOptions{ReadOnly: true})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
......
...@@ -348,7 +348,7 @@ func testPersistentDB(t0 *testing.T, rawcache bool) { ...@@ -348,7 +348,7 @@ func testPersistentDB(t0 *testing.T, rawcache bool) {
// open connection to it via zodb/go // open connection to it via zodb/go
ctx := context.Background() ctx := context.Background()
stor, err := OpenStorage(ctx, zurl, &OpenOptions{ReadOnly: true, NoCache: !rawcache}); X(err) stor, err := Open(ctx, zurl, &OpenOptions{ReadOnly: true, NoCache: !rawcache}); X(err)
db := NewDB(stor) db := NewDB(stor)
defer func() { defer func() {
err := db.Close(); X(err) err := db.Close(); X(err)
......
...@@ -32,7 +32,7 @@ import ( ...@@ -32,7 +32,7 @@ import (
"lab.nexedi.com/kirr/go123/xcontext" "lab.nexedi.com/kirr/go123/xcontext"
) )
// OpenOptions describes options for OpenStorage. // OpenOptions describes options for Open.
type OpenOptions struct { type OpenOptions struct {
ReadOnly bool // whether to open storage as read-only ReadOnly bool // whether to open storage as read-only
NoCache bool // don't use cache for read/write operations; prefetch will be noop NoCache bool // don't use cache for read/write operations; prefetch will be noop
...@@ -73,14 +73,14 @@ func RegisterDriver(scheme string, opener DriverOpener) { ...@@ -73,14 +73,14 @@ func RegisterDriver(scheme string, opener DriverOpener) {
driverRegistry[scheme] = opener driverRegistry[scheme] = opener
} }
// OpenStorage opens ZODB storage by URL. // Open opens ZODB storage by URL.
// //
// Only URL schemes registered to zodb package are handled. // Only URL schemes registered to zodb package are handled.
// Users should import in storage packages they use or zodb/wks package to // Users should import in storage packages they use or zodb/wks package to
// get support for well-known storages. // get support for well-known storages.
// //
// Storage authors should register their storages with RegisterStorage. // Storage authors should register their storages with RegisterStorage.
func OpenStorage(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error) { func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error) {
// no scheme -> file:// // no scheme -> file://
if !strings.Contains(zurl, "://") { if !strings.Contains(zurl, "://") {
zurl = "file://" + zurl zurl = "file://" + zurl
...@@ -142,7 +142,7 @@ func OpenStorage(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, ...@@ -142,7 +142,7 @@ func OpenStorage(ctx context.Context, zurl string, opt *OpenOptions) (IStorage,
// storage represents storage opened via OpenStorage. // storage represents storage opened via Open.
// //
// it provides a small cache on top of raw storage driver to implement prefetch // it provides a small cache on top of raw storage driver to implement prefetch
// and other storage-independent higher-level functionality. // and other storage-independent higher-level functionality.
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
// //
// Unless one is doing something FileStorage-specific, it is advised not to use // Unless one is doing something FileStorage-specific, it is advised not to use
// fs1 package directly, and instead link-in lab.nexedi.com/kirr/neo/go/zodb/wks, // fs1 package directly, and instead link-in lab.nexedi.com/kirr/neo/go/zodb/wks,
// open storage by zodb.OpenStorage and use it by way of zodb.IStorage interface. // open storage by zodb.Open and use it by way of zodb.IStorage interface.
// //
// The fs1 package exposes all FileStorage data format details and most of // The fs1 package exposes all FileStorage data format details and most of
// internal workings so that it is possible to implement FileStorage-specific // internal workings so that it is possible to implement FileStorage-specific
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
// The storage layer provides access to a ZODB database in terms of database // The storage layer provides access to a ZODB database in terms of database
// records with raw bytes payload. // records with raw bytes payload.
// //
// At storage level a ZODB database can be opened with OpenStorage. Once opened // At storage level a ZODB database can be opened with Open. Once opened
// IStorage interface is returned that represents access to the database. // IStorage interface is returned that represents access to the database.
// Please see IStorage, and interfaces it embeds, for details. // Please see IStorage, and interfaces it embeds, for details.
// //
......
...@@ -126,7 +126,7 @@ func catobjMain(argv []string) { ...@@ -126,7 +126,7 @@ func catobjMain(argv []string) {
ctx := context.Background() ctx := context.Background()
stor, err := zodb.OpenStorage(ctx, zurl, &zodb.OpenOptions{ReadOnly: true}) stor, err := zodb.Open(ctx, zurl, &zodb.OpenOptions{ReadOnly: true})
if err != nil { if err != nil {
prog.Fatal(err) prog.Fatal(err)
} }
......
...@@ -271,7 +271,7 @@ func dumpMain(argv []string) { ...@@ -271,7 +271,7 @@ func dumpMain(argv []string) {
ctx := context.Background() ctx := context.Background()
stor, err := zodb.OpenStorage(ctx, zurl, &zodb.OpenOptions{ReadOnly: true}) stor, err := zodb.Open(ctx, zurl, &zodb.OpenOptions{ReadOnly: true})
if err != nil { if err != nil {
prog.Fatal(err) prog.Fatal(err)
} }
......
// Copyright (C) 2016-2017 Nexedi SA and Contributors. // Copyright (C) 2016-2019 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
...@@ -67,7 +67,7 @@ func loadZdumpPy(t *testing.T, path string) string { ...@@ -67,7 +67,7 @@ func loadZdumpPy(t *testing.T, path string) string {
} }
func withTestdataFs(t testing.TB, db string, f func(zstor zodb.IStorage)) { func withTestdataFs(t testing.TB, db string, f func(zstor zodb.IStorage)) {
zstor, err := zodb.OpenStorage(context.Background(), fmt.Sprintf("../../zodb/storage/fs1/testdata/%s.fs", db), &zodb.OpenOptions{ReadOnly: true}) zstor, err := zodb.Open(context.Background(), fmt.Sprintf("../../zodb/storage/fs1/testdata/%s.fs", db), &zodb.OpenOptions{ReadOnly: true})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
......
...@@ -125,7 +125,7 @@ func infoMain(argv []string) { ...@@ -125,7 +125,7 @@ func infoMain(argv []string) {
ctx := context.Background() ctx := context.Background()
stor, err := zodb.OpenStorage(ctx, zurl, &zodb.OpenOptions{ReadOnly: true}) stor, err := zodb.Open(ctx, zurl, &zodb.OpenOptions{ReadOnly: true})
if err != nil { if err != nil {
prog.Fatal(err) prog.Fatal(err)
} }
......
...@@ -154,7 +154,7 @@ func watchMain(argv []string) { ...@@ -154,7 +154,7 @@ func watchMain(argv []string) {
ctx := context.Background() ctx := context.Background()
stor, err := zodb.OpenStorage(ctx, zurl, &zodb.OpenOptions{ReadOnly: true}) stor, err := zodb.Open(ctx, zurl, &zodb.OpenOptions{ReadOnly: true})
if err != nil { if err != nil {
prog.Fatal(err) prog.Fatal(err)
} }
......
...@@ -62,7 +62,7 @@ func TestWatch(t *testing.T) { ...@@ -62,7 +62,7 @@ func TestWatch(t *testing.T) {
// open tfs at go side // open tfs at go side
bg := context.Background() bg := context.Background()
stor, err := zodb.OpenStorage(bg, tfs, &zodb.OpenOptions{ReadOnly: true}); X(err) stor, err := zodb.Open(bg, tfs, &zodb.OpenOptions{ReadOnly: true}); X(err)
// spawn plain and verbose watchers // spawn plain and verbose watchers
ctx0, cancel := context.WithCancel(bg) ctx0, cancel := context.WithCancel(bg)
......
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