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
4a0208b4
Commit
4a0208b4
authored
Apr 25, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d237f4fe
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
220 additions
and
7 deletions
+220
-7
go/neo/client/client.go
go/neo/client/client.go
+37
-1
go/neo/cmd/neo/neo.go
go/neo/cmd/neo/neo.go
+92
-0
go/neo/storage/main.go
go/neo/storage/main.go
+79
-0
go/neo/storage/storage.go
go/neo/storage/storage.go
+8
-4
go/zodb/zodb.go
go/zodb/zodb.go
+3
-2
go/zodb/zodbtools/dump.go
go/zodb/zodbtools/dump.go
+1
-0
No files found.
go/neo/client/client.go
View file @
4a0208b4
...
@@ -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"
)
}
go/neo/cmd/neo/neo.go
0 → 100644
View file @
4a0208b4
// 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
)
}
go/neo/
cmd/neo/neostorage
.go
→
go/neo/
storage/main
.go
View file @
4a0208b4
// 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
()
...
...
go/neo/storage/storage.go
View file @
4a0208b4
...
@@ -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
...
...
go/zodb/zodb.go
View file @
4a0208b4
...
@@ -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.
...
...
go/zodb/zodbtools/dump.go
View file @
4a0208b4
...
@@ -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
{
...
...
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