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
e2266200
Commit
e2266200
authored
Apr 25, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4a0208b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
96 deletions
+69
-96
go/neo/client.go
go/neo/client.go
+12
-13
go/neo/storage.go
go/neo/storage.go
+57
-4
go/neo/storage/main.go
go/neo/storage/main.go
+0
-79
No files found.
go/neo/client
/client
.go
→
go/neo/client.go
View file @
e2266200
...
...
@@ -15,41 +15,40 @@
//
// See COPYING file for full licensing terms.
// Package client provides access to NEO database via ZODB interfaces
package
client
package
neo
// access to NEO database via ZODB interfaces
import
(
"../../neo"
"../../zodb"
"../zodb"
)
type
NEO
Client
struct
{
storLink
neo
.
NodeLink
// link to storage node
type
Client
struct
{
storLink
NodeLink
// link to storage node
}
var
_
zodb
.
IStorage
=
(
*
NEO
Client
)(
nil
)
var
_
zodb
.
IStorage
=
(
*
Client
)(
nil
)
//func Open(...) (*
NEO
Client, error) {
//func Open(...) (*Client, error) {
//}
func
(
c
*
NEO
Client
)
StorageName
()
string
{
func
(
c
*
Client
)
StorageName
()
string
{
return
"neo"
// TODO more specific
}
func
(
c
*
NEO
Client
)
Close
()
error
{
func
(
c
*
Client
)
Close
()
error
{
panic
(
"TODO"
)
}
func
(
c
*
NEO
Client
)
LastTid
()
zodb
.
Tid
{
func
(
c
*
Client
)
LastTid
()
zodb
.
Tid
{
panic
(
"TODO"
)
}
func
(
c
*
NEO
Client
)
Load
(
xid
zodb
.
Xid
)
(
data
[]
byte
,
tid
zodb
.
Tid
,
err
error
)
{
func
(
c
*
Client
)
Load
(
xid
zodb
.
Xid
)
(
data
[]
byte
,
tid
zodb
.
Tid
,
err
error
)
{
panic
(
"TODO"
)
}
func
(
c
*
NEO
Client
)
Iterate
(
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
IStorageIterator
{
func
(
c
*
Client
)
Iterate
(
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
IStorageIterator
{
panic
(
"TODO"
)
}
go/neo/storage
/storage
.go
→
go/neo/storage.go
View file @
e2266200
...
...
@@ -15,15 +15,19 @@
//
// See COPYING file for full licensing terms.
// TODO text
package
storage
package
neo
// NEO storage node
import
(
"context"
"flag"
"fmt"
"io"
"log"
"os"
"../../zodb"
"../zodb"
_
"../zodb/wks"
)
// NEO Storage application
...
...
@@ -194,3 +198,52 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *Conn) {
//req.Put(...)
}
}
// ----------------------------------------
const
storageSummary
=
"run NEO storage node"
// TODO options:
// cluster, masterv, bind ...
func
storageUsage
(
w
io
.
Writer
)
{
fmt
.
Fprintf
(
w
,
`neostorage runs one NEO storage server.
Usage: neostorage [options] zstor XXX
`
)
}
func
storageMain
(
argv
[]
string
)
{
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
storageUsage
(
os
.
Stderr
)
}}
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
Parse
(
argv
[
1
:
])
argv
=
flags
.
Args
()
if
len
(
argv
)
<
1
{
flags
.
Usage
()
os
.
Exit
(
2
)
}
// XXX hack
zstor
,
err
:=
zodb
.
OpenStorageURL
(
argv
[
0
])
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
storsrv
:=
NewStorage
(
zstor
)
/*
ctx, cancel := context.WithCancel(context.Background())
go func() {
time.Sleep(5 * time.Second)
cancel()
}()
*/
ctx
:=
context
.
Background
()
err
=
ListenAndServe
(
ctx
,
"tcp"
,
"localhost:1234"
,
storsrv
)
// XXX hardcoded
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
}
go/neo/storage/main.go
deleted
100644 → 0
View file @
4a0208b4
// 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
package
storage
import
(
"context"
"flag"
"fmt"
"log"
"os"
//_ "../../storage" // XXX rel ok?
neo
"../../neo"
zodb
"../../zodb"
_
"../../zodb/wks"
)
// TODO options:
// cluster, masterv, bind ...
func
usage
()
{
fmt
.
Fprintf
(
os
.
Stderr
,
`neostorage runs one NEO storage server.
Usage: neostorage [options] zstor XXX
`
)
}
// -> StorageMain
func
main
()
{
flag
.
Usage
=
usage
flag
.
Parse
()
argv
:=
flag
.
Args
()
if
len
(
argv
)
==
0
{
usage
()
os
.
Exit
(
2
)
}
zstor
,
err
:=
zodb
.
OpenStorageURL
(
argv
[
0
])
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
storsrv
:=
neo
.
NewStorage
(
zstor
)
/*
ctx, cancel := context.WithCancel(context.Background())
go func() {
time.Sleep(5 * time.Second)
cancel()
}()
*/
ctx
:=
context
.
Background
()
err
=
neo
.
ListenAndServe
(
ctx
,
"tcp"
,
"localhost:1234"
,
storsrv
)
if
err
!=
nil
{
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