Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
chore: deprecate exported types
Browse files Browse the repository at this point in the history
  • Loading branch information
guseggert committed May 10, 2023
1 parent 6ecaba9 commit 389a1e5
Show file tree
Hide file tree
Showing 27 changed files with 160 additions and 4 deletions.
2 changes: 2 additions & 0 deletions block.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

// BlockStat contains information about a block
// Deprecated: use github.com/ipfs/boxo/coreiface.BlockStat
type BlockStat interface {
// Size is the size of a block
Size() int
Expand All @@ -19,6 +20,7 @@ type BlockStat interface {
}

// BlockAPI specifies the interface to the block layer
// Deprecated: use github.com/ipfs/boxo/coreiface.BlockAPI
type BlockAPI interface {
// Put imports raw block data, hashing it using specified settings.
Put(context.Context, io.Reader, ...options.BlockPutOption) (BlockStat, error)
Expand Down
1 change: 1 addition & 0 deletions coreapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

// CoreAPI defines an unified interface to IPFS for Go programs
// Deprecated: use github.com/ipfs/boxo/coreiface.CoreAPI
type CoreAPI interface {
// Unixfs returns an implementation of Unixfs API
Unixfs() UnixfsAPI
Expand Down
1 change: 1 addition & 0 deletions dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
)

// APIDagService extends ipld.DAGService
// Deprecated: use github.com/ipfs/boxo/coreiface.APIDagService
type APIDagService interface {
ipld.DAGService

Expand Down
1 change: 1 addition & 0 deletions dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
// DhtAPI specifies the interface to the DHT
// Note: This API will likely get deprecated in near future, see
// https://github.com/ipfs/interface-ipfs-core/issues/249 for more context.
// Deprecated: use github.com/ipfs/boxo/coreiface.DhtAPI
type DhtAPI interface {
// FindPeer queries the DHT for all of the multiaddresses associated with a
// Peer ID
Expand Down
10 changes: 7 additions & 3 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ package iface
import "errors"

var (
ErrIsDir = errors.New("this dag node is a directory")
ErrNotFile = errors.New("this dag node is not a regular file")
ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first")
// Deprecated: use github.com/ipfs/boxo/coreiface.ErrIsDir
ErrIsDir = errors.New("this dag node is a directory")
// Deprecated: use github.com/ipfs/boxo/coreiface.ErrNotFile
ErrNotFile = errors.New("this dag node is not a regular file")
// Deprecated: use github.com/ipfs/boxo/coreiface.ErrOffline
ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first")
// Deprecated: use github.com/ipfs/boxo/coreiface.ErrNotSupported
ErrNotSupported = errors.New("operation not supported")
)
2 changes: 2 additions & 0 deletions idfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
mbase "github.com/multiformats/go-multibase"
)

// Deprecated: use github.com/ipfs/boxo/coreiface.FormatKeyID
func FormatKeyID(id peer.ID) string {
if s, err := peer.ToCid(id).StringOfBase(mbase.Base36); err != nil {
panic(err)
Expand All @@ -14,6 +15,7 @@ func FormatKeyID(id peer.ID) string {
}

// FormatKey formats the given IPNS key in a canonical way.
// Deprecated: use github.com/ipfs/boxo/coreiface.FormatKey
func FormatKey(key Key) string {
return FormatKeyID(key.ID())
}
2 changes: 2 additions & 0 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

// Key specifies the interface to Keys in KeyAPI Keystore
// Deprecated: use github.com/ipfs/boxo/coreiface.Key
type Key interface {
// Key returns key name
Name() string
Expand All @@ -23,6 +24,7 @@ type Key interface {
}

// KeyAPI specifies the interface to Keystore
// Deprecated: use github.com/ipfs/boxo/coreiface.KeyAPI
type KeyAPI interface {
// Generate generates new key, stores it in the keystore under the specified
// name and returns a base58 encoded multihash of it's public key
Expand Down
3 changes: 3 additions & 0 deletions name.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import (
var ErrResolveFailed = errors.New("could not resolve name")

// IpnsEntry specifies the interface to IpnsEntries
// Deprecated: use github.com/ipfs/boxo/coreiface.IpnsEntry
type IpnsEntry interface {
// Name returns IpnsEntry name
Name() string
// Value returns IpnsEntry value
Value() path.Path
}

// Deprecated: use github.com/ipfs/boxo/coreiface.IpnsResult
type IpnsResult struct {
path.Path
Err error
Expand All @@ -32,6 +34,7 @@ type IpnsResult struct {
// its public key.
//
// You can use .Key API to list and generate more names and their respective keys.
// Deprecated: use github.com/ipfs/boxo/coreiface.NameAPI
type NameAPI interface {
// Publish announces new IPNS name
Publish(ctx context.Context, path path.Path, opts ...options.NamePublishOption) (IpnsEntry, error)
Expand Down
7 changes: 7 additions & 0 deletions object.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

// ObjectStat provides information about dag nodes
// Deprecated: use github.com/ipfs/boxo/coreiface.ObjectStat
type ObjectStat struct {
// Cid is the CID of the node
Cid cid.Cid
Expand All @@ -34,20 +35,25 @@ type ObjectStat struct {
}

// ChangeType denotes type of change in ObjectChange
// Deprecated: use github.com/ipfs/boxo/coreiface.ChangeType
type ChangeType int

const (
// DiffAdd is set when a link was added to the graph
// Deprecated: use github.com/ipfs/boxo/coreiface.DiffAdd
DiffAdd ChangeType = iota

// DiffRemove is set when a link was removed from the graph
// Deprecated: use github.com/ipfs/boxo/coreiface.DiffRemove
DiffRemove

// DiffMod is set when a link was changed in the graph
// Deprecated: use github.com/ipfs/boxo/coreiface.DiffMod
DiffMod
)

// ObjectChange represents a change ia a graph
// Deprecated: use github.com/ipfs/boxo/coreiface.ObjectChange
type ObjectChange struct {
// Type of the change, either:
// * DiffAdd - Added a link
Expand All @@ -69,6 +75,7 @@ type ObjectChange struct {

// ObjectAPI specifies the interface to MerkleDAG and contains useful utilities
// for manipulating MerkleDAG data structures.
// Deprecated: use github.com/ipfs/boxo/coreiface.ObjectAPI
type ObjectAPI interface {
// New creates new, empty (by default) dag-node.
New(context.Context, ...options.ObjectNewOption) (ipld.Node, error)
Expand Down
8 changes: 8 additions & 0 deletions options/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@ import (
mh "github.com/multiformats/go-multihash"
)

// Deprecated: use github.com/ipfs/boxo/coreiface/options.BlockPutSettings
type BlockPutSettings struct {
CidPrefix cid.Prefix
Pin bool
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.BlockRmSettings
type BlockRmSettings struct {
Force bool
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.BlockPutOption
type BlockPutOption func(*BlockPutSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.BlockRmOption
type BlockRmOption func(*BlockRmSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.BlockPutOptions
func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) {
var cidPrefix cid.Prefix

Expand All @@ -45,6 +51,7 @@ func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) {
return options, nil
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.BlockRmOptions
func BlockRmOptions(opts ...BlockRmOption) (*BlockRmSettings, error) {
options := &BlockRmSettings{
Force: false,
Expand All @@ -61,6 +68,7 @@ func BlockRmOptions(opts ...BlockRmOption) (*BlockRmSettings, error) {

type blockOpts struct{}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.Block
var Block blockOpts

// CidCodec is the modern option for Block.Put which specifies the multicodec to use
Expand Down
8 changes: 8 additions & 0 deletions options/dht.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package options

// Deprecated: use github.com/ipfs/boxo/coreiface/options.DhtProvideSettings
type DhtProvideSettings struct {
Recursive bool
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.DhtFindProvidersSettings
type DhtFindProvidersSettings struct {
NumProviders int
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.DhtProvideOption
type DhtProvideOption func(*DhtProvideSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.DhtFindProvidersOption
type DhtFindProvidersOption func(*DhtFindProvidersSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.DhtProvideOptions
func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) {
options := &DhtProvideSettings{
Recursive: false,
Expand All @@ -25,6 +31,7 @@ func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) {
return options, nil
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.DhtFindProvidersOptions
func DhtFindProvidersOptions(opts ...DhtFindProvidersOption) (*DhtFindProvidersSettings, error) {
options := &DhtFindProvidersSettings{
NumProviders: 20,
Expand All @@ -41,6 +48,7 @@ func DhtFindProvidersOptions(opts ...DhtFindProvidersOption) (*DhtFindProvidersS

type dhtOpts struct{}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.Dht
var Dht dhtOpts

// Recursive is an option for Dht.Provide which specifies whether to provide
Expand Down
5 changes: 5 additions & 0 deletions options/global.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package options

// Deprecated: use github.com/ipfs/boxo/coreiface/options.ApiSettings
type ApiSettings struct {
Offline bool
FetchBlocks bool
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.ApiOption
type ApiOption func(*ApiSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.ApiOptions
func ApiOptions(opts ...ApiOption) (*ApiSettings, error) {
options := &ApiSettings{
Offline: false,
Expand All @@ -16,6 +19,7 @@ func ApiOptions(opts ...ApiOption) (*ApiSettings, error) {
return ApiOptionsTo(options, opts...)
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.ApiOptionsTo
func ApiOptionsTo(options *ApiSettings, opts ...ApiOption) (*ApiSettings, error) {
for _, opt := range opts {
err := opt(options)
Expand All @@ -28,6 +32,7 @@ func ApiOptionsTo(options *ApiSettings, opts ...ApiOption) (*ApiSettings, error)

type apiOpts struct{}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.Api
var Api apiOpts

func (apiOpts) Offline(offline bool) ApiOption {
Expand Down
13 changes: 12 additions & 1 deletion options/key.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
package options

const (
RSAKey = "rsa"
// Deprecated: use github.com/ipfs/boxo/coreiface/options.RSAKey
RSAKey = "rsa"
// Deprecated: use github.com/ipfs/boxo/coreiface/options.Ed25519Key
Ed25519Key = "ed25519"

// Deprecated: use github.com/ipfs/boxo/coreiface/options.DefaultRSALen
DefaultRSALen = 2048
)

// Deprecated: use github.com/ipfs/boxo/coreiface/options.KeyGenerateSettings
type KeyGenerateSettings struct {
Algorithm string
Size int
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.KeyRenameSettings
type KeyRenameSettings struct {
Force bool
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.KeyGenerateOption
type KeyGenerateOption func(*KeyGenerateSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.KeyRenameOption
type KeyRenameOption func(*KeyRenameSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.KeyGenerateOptions
func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error) {
options := &KeyGenerateSettings{
Algorithm: RSAKey,
Expand All @@ -34,6 +43,7 @@ func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error)
return options, nil
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.KeyRenameOptions
func KeyRenameOptions(opts ...KeyRenameOption) (*KeyRenameSettings, error) {
options := &KeyRenameSettings{
Force: false,
Expand All @@ -50,6 +60,7 @@ func KeyRenameOptions(opts ...KeyRenameOption) (*KeyRenameSettings, error) {

type keyOpts struct{}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.Key
var Key keyOpts

// Type is an option for Key.Generate which specifies which algorithm
Expand Down
7 changes: 7 additions & 0 deletions options/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
)

const (
// Deprecated: use github.com/ipfs/boxo/coreiface/options.DefaultNameValidTime
DefaultNameValidTime = 24 * time.Hour
)

// Deprecated: use github.com/ipfs/boxo/coreiface/options.NamePublishSettings
type NamePublishSettings struct {
ValidTime time.Duration
Key string
Expand All @@ -19,13 +21,17 @@ type NamePublishSettings struct {
AllowOffline bool
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.NameResolveSettings
type NameResolveSettings struct {
Cache bool

ResolveOpts []ropts.ResolveOpt
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.NamePublishOption
type NamePublishOption func(*NamePublishSettings) error

// Deprecated: use github.com/ipfs/boxo/coreiface/options.NameResolveOption
type NameResolveOption func(*NameResolveSettings) error

func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) {
Expand All @@ -46,6 +52,7 @@ func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error)
return options, nil
}

// Deprecated: use github.com/ipfs/boxo/coreiface/options.NameResolveOptions
func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) {
options := &NameResolveSettings{
Cache: true,
Expand Down
Loading

0 comments on commit 389a1e5

Please sign in to comment.