Skip to content

Commit

Permalink
Merge branch 'master' into big-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
djdv authored Mar 23, 2018
2 parents a20f315 + 3cbf97b commit 9a9a6ac
Show file tree
Hide file tree
Showing 100 changed files with 1,385 additions and 2,156 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# go-ipfs changelog

## 0.4.14 2018-03-02
## 0.4.14 2018-03-22

Ipfs 0.4.14 is a big release with a large number of improvements and bugfixes.
It is also the first release of 2018, and our first release in over three
Expand Down Expand Up @@ -54,6 +54,13 @@ did allow manually creating them and fetching them from other peers. If you
currently have objects using insecure hashes in your local ipfs repo, please
remove them before updating.

#### Changes from rc2 to rc3
- Fix bug in stdin argument parsing ([ipfs/go-ipfs#4827](https://github.com/ipfs/go-ipfs/pull/4827))
- Revert commands back to sending a single response ([ipfs/go-ipfs#4822](https://github.com/ipfs/go-ipfs/pull/4822))

#### Changes from rc1 to rc2
- Fix issue in ipfs get caused by go1.10 changes ([ipfs/go-ipfs#4790](https://github.com/ipfs/go-ipfs/pull/4790))

- Features
- Pubsub IPNS Publisher and Resolver (experimental) ([ipfs/go-ipfs#4047](https://github.com/ipfs/go-ipfs/pull/4047))
- Implement coreapi Dag interface ([ipfs/go-ipfs#4471](https://github.com/ipfs/go-ipfs/pull/4471))
Expand Down
12 changes: 10 additions & 2 deletions blockservice/blockservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ func (s *blockService) AddBlock(o blocks.Block) error {
return err
}

log.Event(context.TODO(), "BlockService.BlockAdded", c)

if err := s.exchange.HasBlock(o); err != nil {
// TODO(#4623): really an error?
return errors.New("blockservice is closed")
Expand Down Expand Up @@ -184,6 +186,7 @@ func (s *blockService) AddBlocks(bs []blocks.Block) error {
}

for _, o := range toput {
log.Event(context.TODO(), "BlockService.BlockAdded", o.Cid())
if err := s.exchange.HasBlock(o); err != nil {
// TODO(#4623): Should this really *return*?
return fmt.Errorf("blockservice is closed (%s)", err)
Expand Down Expand Up @@ -227,6 +230,7 @@ func getBlock(ctx context.Context, c *cid.Cid, bs blockstore.Blockstore, f excha
}
return nil, err
}
log.Event(ctx, "BlockService.BlockFetched", c)
return blk, nil
}

Expand Down Expand Up @@ -263,7 +267,6 @@ func getBlocks(ctx context.Context, ks []*cid.Cid, bs blockstore.Blockstore, f e
misses = append(misses, c)
continue
}
log.Debug("Blockservice: Got data in datastore")
select {
case out <- hit:
case <-ctx.Done():
Expand All @@ -282,6 +285,7 @@ func getBlocks(ctx context.Context, ks []*cid.Cid, bs blockstore.Blockstore, f e
}

for b := range rblocks {
log.Event(ctx, "BlockService.BlockFetched", b.Cid())
select {
case out <- b:
case <-ctx.Done():
Expand All @@ -294,7 +298,11 @@ func getBlocks(ctx context.Context, ks []*cid.Cid, bs blockstore.Blockstore, f e

// DeleteBlock deletes a block in the blockservice from the datastore
func (s *blockService) DeleteBlock(c *cid.Cid) error {
return s.blockstore.DeleteBlock(c)
err := s.blockstore.DeleteBlock(c)
if err == nil {
log.Event(context.TODO(), "BlockService.BlockDeleted", c)
}
return err
}

func (s *blockService) Close() error {
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile.buildenv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.9
FROM golang:1.10
MAINTAINER Jakub Sztandera <kubuxu@ipfs.io>


Expand Down
8 changes: 6 additions & 2 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ import (
iconn "gx/ipfs/QmToCvh5eJtoDheMggre7b2zeFCJ6tAyB82YVs457cqoUE/go-libp2p-interface-conn"
ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr"
"gx/ipfs/QmX3QZ5jHEPidwUrymXV1iSCSUhdGxj15sm2gP4jKMef7B/client_golang/prometheus"
cmds "gx/ipfs/QmabLouZTZwhfALuBcssPvkzhbYGMb4394huT7HY4LQ6d3/go-ipfs-cmds"
"gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit"
cmds "gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds"
)

const (
adjustFDLimitKwd = "manage-fdlimit"
enableGCKwd = "enable-gc"
initOptionKwd = "init"
initProfileOptionKwd = "init-profile"
ipfsMountKwd = "mount-ipfs"
ipnsMountKwd = "mount-ipns"
migrateKwd = "migrate"
Expand Down Expand Up @@ -148,6 +149,7 @@ Headers.

Options: []cmdkit.Option{
cmdkit.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized"),
cmdkit.StringOption(initProfileOptionKwd, "Configuration profiles to apply for --init. See ipfs init --help for more"),
cmdkit.StringOption(routingOptionKwd, "Overrides the routing option").WithDefault("dht"),
cmdkit.BoolOption(mountKwd, "Mounts IPFS to the filesystem"),
cmdkit.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
Expand Down Expand Up @@ -222,7 +224,9 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment

cfg := cctx.ConfigRoot
if !fsrepo.IsInitialized(cfg) {
err := initWithDefaults(os.Stdout, cfg)
profiles, _ := req.Options[initProfileOptionKwd].(string)

err := initWithDefaults(os.Stdout, cfg, profiles)
if err != nil {
re.SetError(err, cmdkit.ErrNormal)
return
Expand Down
48 changes: 20 additions & 28 deletions cmd/ipfs/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (
"strings"

assets "github.com/ipfs/go-ipfs/assets"
cmds "github.com/ipfs/go-ipfs/commands"
oldcmds "github.com/ipfs/go-ipfs/commands"
core "github.com/ipfs/go-ipfs/core"
namesys "github.com/ipfs/go-ipfs/namesys"
config "github.com/ipfs/go-ipfs/repo/config"
fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"

"gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit"
"gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds"
)

const (
Expand Down Expand Up @@ -59,8 +60,9 @@ environment variable:
// name of the file?
// TODO cmdkit.StringOption("event-logs", "l", "Location for machine-readable event logs."),
},
PreRun: func(req cmds.Request) error {
daemonLocked, err := fsrepo.LockedByOtherProcess(req.InvocContext().ConfigRoot)
PreRun: func(req *cmds.Request, env cmds.Environment) error {
cctx := env.(*oldcmds.Context)
daemonLocked, err := fsrepo.LockedByOtherProcess(cctx.ConfigRoot)
if err != nil {
return err
}
Expand All @@ -74,30 +76,19 @@ environment variable:

return nil
},
Run: func(req cmds.Request, res cmds.Response) {
// needs to be called at least once
res.SetOutput(nil)

if req.InvocContext().Online {
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) {
cctx := env.(*oldcmds.Context)
if cctx.Online {
res.SetError(errors.New("init must be run offline only!"), cmdkit.ErrNormal)
return
}

empty, _, err := req.Option("e").Bool()
if err != nil {
res.SetError(err, cmdkit.ErrNormal)
return
}

nBitsForKeypair, _, err := req.Option("b").Int()
if err != nil {
res.SetError(err, cmdkit.ErrNormal)
return
}
empty, _ := req.Options["empty-repo"].(bool)
nBitsForKeypair, _ := req.Options["bits"].(int)

var conf *config.Config

f := req.Files()
f := req.Files
if f != nil {
confFile, err := f.NextFile()
if err != nil {
Expand All @@ -112,18 +103,14 @@ environment variable:
}
}

profile, _, err := req.Option("profile").String()
if err != nil {
res.SetError(err, cmdkit.ErrNormal)
return
}
profile, _ := req.Options["profile"].(string)

var profiles []string
if profile != "" {
profiles = strings.Split(profile, ",")
}

if err := doInit(os.Stdout, req.InvocContext().ConfigRoot, empty, nBitsForKeypair, profiles, conf); err != nil {
if err := doInit(os.Stdout, cctx.ConfigRoot, empty, nBitsForKeypair, profiles, conf); err != nil {
res.SetError(err, cmdkit.ErrNormal)
return
}
Expand All @@ -134,8 +121,13 @@ var errRepoExists = errors.New(`ipfs configuration file already exists!
Reinitializing would overwrite your keys.
`)

func initWithDefaults(out io.Writer, repoRoot string) error {
return doInit(out, repoRoot, false, nBitsForKeypairDefault, nil, nil)
func initWithDefaults(out io.Writer, repoRoot string, profile string) error {
var profiles []string
if profile != "" {
profiles = strings.Split(profile, ",")
}

return doInit(out, repoRoot, false, nBitsForKeypairDefault, profiles, nil)
}

func doInit(out io.Writer, repoRoot string, empty bool, nBitsForKeypair int, confProfiles []string, conf *config.Config) error {
Expand Down
5 changes: 2 additions & 3 deletions cmd/ipfs/ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (

commands "github.com/ipfs/go-ipfs/core/commands"

lgc "github.com/ipfs/go-ipfs/commands/legacy"
cmds "gx/ipfs/QmabLouZTZwhfALuBcssPvkzhbYGMb4394huT7HY4LQ6d3/go-ipfs-cmds"
cmds "gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds"
)

// This is the CLI root, used for executing commands accessible to CLI clients.
Expand All @@ -24,7 +23,7 @@ var commandsClientCmd = commands.CommandsCmd(Root)
// They can override subcommands in commands.Root by defining a subcommand with the same name.
var localCommands = map[string]*cmds.Command{
"daemon": daemonCmd,
"init": lgc.NewCommand(initCmd),
"init": initCmd,
"commands": commandsClientCmd,
}
var localMap = make(map[*cmds.Command]bool)
Expand Down
6 changes: 3 additions & 3 deletions cmd/ipfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ import (
logging "gx/ipfs/QmRb5jh8z2E8hMGN2tkvs1yHynUanqnZ3UeKwgN1i9P1F8/go-log"
ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr"
osh "gx/ipfs/QmXuBJ7DR6k3rmUEKtvVMhwjmXDuJgXXPUt4LQXKBMsU93/go-os-helper"
"gx/ipfs/QmabLouZTZwhfALuBcssPvkzhbYGMb4394huT7HY4LQ6d3/go-ipfs-cmds"
"gx/ipfs/QmabLouZTZwhfALuBcssPvkzhbYGMb4394huT7HY4LQ6d3/go-ipfs-cmds/cli"
"gx/ipfs/QmabLouZTZwhfALuBcssPvkzhbYGMb4394huT7HY4LQ6d3/go-ipfs-cmds/http"
loggables "gx/ipfs/Qmf9JgVLz46pxPXwG2eWSJpkqVCcjD4rp7zCRi2KP6GTNB/go-libp2p-loggables"
"gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds"
"gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds/cli"
"gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds/http"
)

// log is the command logger
Expand Down
2 changes: 1 addition & 1 deletion cmd/seccat/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type logRW struct {

func (r *logRW) Read(buf []byte) (int, error) {
n, err := r.rw.Read(buf)
if err == nil {
if n > 0 {
log.Debugf("%s read: %v", r.n, buf)
}
return n, err
Expand Down
11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ codecov:
notify:
require_ci_to_pass: no
after_n_builds: 2

coverage:
range: "50...100"

status:
project:
default:
threshold: 0.2%

patch:
default:
threshold: 2%

comment: off
44 changes: 0 additions & 44 deletions commands/channelmarshaler.go

This file was deleted.

Loading

0 comments on commit 9a9a6ac

Please sign in to comment.