Commit 4a0208b4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d237f4fe
...@@ -15,5 +15,41 @@ ...@@ -15,5 +15,41 @@
// //
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// Package client provides zodb.IStorage access to NEO database // Package client provides access to NEO database via ZODB interfaces
package client package client
import (
"../../neo"
"../../zodb"
)
type NEOClient struct {
storLink neo.NodeLink // link to storage node
}
var _ zodb.IStorage = (*NEOClient)(nil)
//func Open(...) (*NEOClient, error) {
//}
func (c *NEOClient) StorageName() string {
return "neo" // TODO more specific
}
func (c *NEOClient) Close() error {
panic("TODO")
}
func (c *NEOClient) LastTid() zodb.Tid {
panic("TODO")
}
func (c *NEOClient) Load(xid zodb.Xid) (data []byte, tid zodb.Tid, err error) {
panic("TODO")
}
func (c *NEOClient) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
panic("TODO")
}
// 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.
// Neo is a driver program for running & invoking NEO commands and services
package main
import (
"flag"
"fmt"
"os"
)
func usage() {
w := os.Stderr
fmt.Fprintf(w,
`Neo is a tool for running NEO services and commands.
Usage:
neo command [arguments]
The commands are:
`)
for _, cmd := range zodbtools.AllCommands() {
fmt.Fprintf(w, "\t%-11s %s\n", cmd.Name, cmd.Summary)
}
fmt.Fprintf(w,
`
Use "zodb help [command]" for more information about a command.
Additional help topics:
`)
for _, topic := range zodbtools.AllHelpTopics() {
fmt.Fprintf(w, "\t%-11s %s\n", topic.Name, topic.Summary)
}
fmt.Fprintf(w,
`
Use "zodb help [topic]" for more information about that topic.
`)
}
// TODO help()
func main() {
flag.Usage = usage
flag.Parse()
argv := flag.Args()
if len(argv) == 0 {
usage()
os.Exit(2)
}
command := argv[0]
// help on a topic
if command == "help" {
help(argv)
return
}
// run subcommand
cmd := zodbtools.LookupCommand(command)
if cmd == nil {
fmt.Fprintf(os.Stderr, "zodb: unknown subcommand \"%s\"", command)
fmt.Fprintf(os.Stderr, "Run 'zodb help' for usage.")
os.Exit(2)
}
cmd.Main(argv)
}
// TODO copyright / license // Copyright (C) 2016-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.
// neostorage - run a storage node of NEO // neostorage - run a storage node of NEO
package main package storage
import ( import (
"context" "context"
...@@ -12,10 +27,10 @@ import ( ...@@ -12,10 +27,10 @@ import (
"os" "os"
//_ "../../storage" // XXX rel ok? //_ "../../storage" // XXX rel ok?
neo "../.." neo "../../neo"
zodb "../../../zodb" zodb "../../zodb"
_ "../../../zodb/wks" _ "../../zodb/wks"
) )
...@@ -30,6 +45,7 @@ Usage: neostorage [options] zstor XXX ...@@ -30,6 +45,7 @@ Usage: neostorage [options] zstor XXX
`) `)
} }
// -> StorageMain
func main() { func main() {
flag.Usage = usage flag.Usage = usage
flag.Parse() flag.Parse()
......
...@@ -2,24 +2,28 @@ ...@@ -2,24 +2,28 @@
// 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 2, or (at your // 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. // 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 // This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// //
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// TODO text // TODO text
// XXX move to separate "storage" package ?
package neo package storage
import ( import (
"context" "context"
"fmt" "fmt"
"../zodb" "../../zodb"
) )
// NEO Storage application // NEO Storage application
......
...@@ -126,11 +126,12 @@ type StorageRecordInformation struct { ...@@ -126,11 +126,12 @@ type StorageRecordInformation struct {
type IStorage interface { type IStorage interface {
Close() error
// StorageName returns storage name // StorageName returns storage name
StorageName() string StorageName() string
// Close closes storage
Close() error
// History(oid, size=1) // History(oid, size=1)
// LastTid returns the id of the last committed transaction. // LastTid returns the id of the last committed transaction.
......
...@@ -249,6 +249,7 @@ func dumpMain(argv []string) { ...@@ -249,6 +249,7 @@ func dumpMain(argv []string) {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
// TODO defer stor.Close()
err = Dump(os.Stdout, stor, tidMin, tidMax, hashOnly) err = Dump(os.Stdout, stor, tidMin, tidMax, hashOnly)
if err != nil { if err != nil {
......
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