Commit 8b65fc5e authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi: don't use underscores in opt reciever funcs

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 2e3f9758
...@@ -53,7 +53,7 @@ var Block blockOpts ...@@ -53,7 +53,7 @@ var Block blockOpts
// Format is an option for Block.Put which specifies the multicodec to use to // Format is an option for Block.Put which specifies the multicodec to use to
// serialize the object. Default is "v0" // serialize the object. Default is "v0"
func (_ blockOpts) Format(codec string) BlockPutOption { func (blockOpts) Format(codec string) BlockPutOption {
return func(settings *BlockPutSettings) error { return func(settings *BlockPutSettings) error {
settings.Codec = codec settings.Codec = codec
return nil return nil
...@@ -63,7 +63,7 @@ func (_ blockOpts) Format(codec string) BlockPutOption { ...@@ -63,7 +63,7 @@ func (_ blockOpts) Format(codec string) BlockPutOption {
// Hash is an option for Block.Put which specifies the multihash settings to use // Hash is an option for Block.Put which specifies the multihash settings to use
// when hashing the object. Default is mh.SHA2_256 (0x12). // when hashing the object. Default is mh.SHA2_256 (0x12).
// If mhLen is set to -1, default length for the hash will be used // If mhLen is set to -1, default length for the hash will be used
func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { func (blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption {
return func(settings *BlockPutSettings) error { return func(settings *BlockPutSettings) error {
settings.MhType = mhType settings.MhType = mhType
settings.MhLength = mhLen settings.MhLength = mhLen
...@@ -73,7 +73,7 @@ func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { ...@@ -73,7 +73,7 @@ func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption {
// Force is an option for Block.Rm which, when set to true, will ignore // Force is an option for Block.Rm which, when set to true, will ignore
// non-existing blocks // non-existing blocks
func (_ blockOpts) Force(force bool) BlockRmOption { func (blockOpts) Force(force bool) BlockRmOption {
return func(settings *BlockRmSettings) error { return func(settings *BlockRmSettings) error {
settings.Force = force settings.Force = force
return nil return nil
......
...@@ -57,7 +57,7 @@ var Dag dagOpts ...@@ -57,7 +57,7 @@ var Dag dagOpts
// InputEnc is an option for Dag.Put which specifies the input encoding of the // InputEnc is an option for Dag.Put which specifies the input encoding of the
// data. Default is "json", most formats/codecs support "raw" // data. Default is "json", most formats/codecs support "raw"
func (_ dagOpts) InputEnc(enc string) DagPutOption { func (dagOpts) InputEnc(enc string) DagPutOption {
return func(settings *DagPutSettings) error { return func(settings *DagPutSettings) error {
settings.InputEnc = enc settings.InputEnc = enc
return nil return nil
...@@ -66,7 +66,7 @@ func (_ dagOpts) InputEnc(enc string) DagPutOption { ...@@ -66,7 +66,7 @@ func (_ dagOpts) InputEnc(enc string) DagPutOption {
// Codec is an option for Dag.Put which specifies the multicodec to use to // Codec is an option for Dag.Put which specifies the multicodec to use to
// serialize the object. Default is cid.DagCBOR (0x71) // serialize the object. Default is cid.DagCBOR (0x71)
func (_ dagOpts) Codec(codec uint64) DagPutOption { func (dagOpts) Codec(codec uint64) DagPutOption {
return func(settings *DagPutSettings) error { return func(settings *DagPutSettings) error {
settings.Codec = codec settings.Codec = codec
return nil return nil
...@@ -77,7 +77,7 @@ func (_ dagOpts) Codec(codec uint64) DagPutOption { ...@@ -77,7 +77,7 @@ func (_ dagOpts) Codec(codec uint64) DagPutOption {
// when hashing the object. Default is based on the codec used // when hashing the object. Default is based on the codec used
// (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for // (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for
// the hash will be used // the hash will be used
func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption { func (dagOpts) Hash(mhType uint64, mhLen int) DagPutOption {
return func(settings *DagPutSettings) error { return func(settings *DagPutSettings) error {
settings.MhType = mhType settings.MhType = mhType
settings.MhLength = mhLen settings.MhLength = mhLen
...@@ -87,7 +87,7 @@ func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption { ...@@ -87,7 +87,7 @@ func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption {
// Depth is an option for Dag.Tree which specifies maximum depth of the // Depth is an option for Dag.Tree which specifies maximum depth of the
// returned tree. Default is -1 (no depth limit) // returned tree. Default is -1 (no depth limit)
func (_ dagOpts) Depth(depth int) DagTreeOption { func (dagOpts) Depth(depth int) DagTreeOption {
return func(settings *DagTreeSettings) error { return func(settings *DagTreeSettings) error {
settings.Depth = depth settings.Depth = depth
return nil return nil
......
...@@ -58,7 +58,7 @@ var Key keyOpts ...@@ -58,7 +58,7 @@ var Key keyOpts
// Supported key types: // Supported key types:
// * options.RSAKey // * options.RSAKey
// * options.Ed25519Key // * options.Ed25519Key
func (_ keyOpts) Type(algorithm string) KeyGenerateOption { func (keyOpts) Type(algorithm string) KeyGenerateOption {
return func(settings *KeyGenerateSettings) error { return func(settings *KeyGenerateSettings) error {
settings.Algorithm = algorithm settings.Algorithm = algorithm
return nil return nil
...@@ -70,7 +70,7 @@ func (_ keyOpts) Type(algorithm string) KeyGenerateOption { ...@@ -70,7 +70,7 @@ func (_ keyOpts) Type(algorithm string) KeyGenerateOption {
// //
// value of -1 means 'use default size for key type': // value of -1 means 'use default size for key type':
// * 2048 for RSA // * 2048 for RSA
func (_ keyOpts) Size(size int) KeyGenerateOption { func (keyOpts) Size(size int) KeyGenerateOption {
return func(settings *KeyGenerateSettings) error { return func(settings *KeyGenerateSettings) error {
settings.Size = size settings.Size = size
return nil return nil
...@@ -79,7 +79,7 @@ func (_ keyOpts) Size(size int) KeyGenerateOption { ...@@ -79,7 +79,7 @@ func (_ keyOpts) Size(size int) KeyGenerateOption {
// Force is an option for Key.Rename which specifies whether to allow to // Force is an option for Key.Rename which specifies whether to allow to
// replace existing keys. // replace existing keys.
func (_ keyOpts) Force(force bool) KeyRenameOption { func (keyOpts) Force(force bool) KeyRenameOption {
return func(settings *KeyRenameSettings) error { return func(settings *KeyRenameSettings) error {
settings.Force = force settings.Force = force
return nil return nil
......
...@@ -61,7 +61,7 @@ var Name nameOpts ...@@ -61,7 +61,7 @@ var Name nameOpts
// ValidTime is an option for Name.Publish which specifies for how long the // ValidTime is an option for Name.Publish which specifies for how long the
// entry will remain valid. Default value is 24h // entry will remain valid. Default value is 24h
func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption { func (nameOpts) ValidTime(validTime time.Duration) NamePublishOption {
return func(settings *NamePublishSettings) error { return func(settings *NamePublishSettings) error {
settings.ValidTime = validTime settings.ValidTime = validTime
return nil return nil
...@@ -73,7 +73,7 @@ func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption { ...@@ -73,7 +73,7 @@ func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption {
// The key parameter must be either PeerID or keystore key alias. // The key parameter must be either PeerID or keystore key alias.
// //
// You can use KeyAPI to list and generate more names and their respective keys. // You can use KeyAPI to list and generate more names and their respective keys.
func (_ nameOpts) Key(key string) NamePublishOption { func (nameOpts) Key(key string) NamePublishOption {
return func(settings *NamePublishSettings) error { return func(settings *NamePublishSettings) error {
settings.Key = key settings.Key = key
return nil return nil
...@@ -82,7 +82,7 @@ func (_ nameOpts) Key(key string) NamePublishOption { ...@@ -82,7 +82,7 @@ func (_ nameOpts) Key(key string) NamePublishOption {
// Recursive is an option for Name.Resolve which specifies whether to perform a // Recursive is an option for Name.Resolve which specifies whether to perform a
// recursive lookup. Default value is false // recursive lookup. Default value is false
func (_ nameOpts) Recursive(recursive bool) NameResolveOption { func (nameOpts) Recursive(recursive bool) NameResolveOption {
return func(settings *NameResolveSettings) error { return func(settings *NameResolveSettings) error {
settings.Recursive = recursive settings.Recursive = recursive
return nil return nil
...@@ -91,7 +91,7 @@ func (_ nameOpts) Recursive(recursive bool) NameResolveOption { ...@@ -91,7 +91,7 @@ func (_ nameOpts) Recursive(recursive bool) NameResolveOption {
// Local is an option for Name.Resolve which specifies if the lookup should be // Local is an option for Name.Resolve which specifies if the lookup should be
// offline. Default value is false // offline. Default value is false
func (_ nameOpts) Local(local bool) NameResolveOption { func (nameOpts) Local(local bool) NameResolveOption {
return func(settings *NameResolveSettings) error { return func(settings *NameResolveSettings) error {
settings.Local = local settings.Local = local
return nil return nil
...@@ -100,7 +100,7 @@ func (_ nameOpts) Local(local bool) NameResolveOption { ...@@ -100,7 +100,7 @@ func (_ nameOpts) Local(local bool) NameResolveOption {
// Cache is an option for Name.Resolve which specifies if cache should be used. // Cache is an option for Name.Resolve which specifies if cache should be used.
// Default value is true // Default value is true
func (_ nameOpts) Cache(cache bool) NameResolveOption { func (nameOpts) Cache(cache bool) NameResolveOption {
return func(settings *NameResolveSettings) error { return func(settings *NameResolveSettings) error {
settings.Cache = cache settings.Cache = cache
return nil return nil
......
...@@ -70,7 +70,7 @@ var Object objectOpts ...@@ -70,7 +70,7 @@ var Object objectOpts
// Supported types: // Supported types:
// * 'empty' - Empty node // * 'empty' - Empty node
// * 'unixfs-dir' - Empty UnixFS directory // * 'unixfs-dir' - Empty UnixFS directory
func (_ objectOpts) Type(t string) ObjectNewOption { func (objectOpts) Type(t string) ObjectNewOption {
return func(settings *ObjectNewSettings) error { return func(settings *ObjectNewSettings) error {
settings.Type = t settings.Type = t
return nil return nil
...@@ -83,7 +83,7 @@ func (_ objectOpts) Type(t string) ObjectNewOption { ...@@ -83,7 +83,7 @@ func (_ objectOpts) Type(t string) ObjectNewOption {
// Supported encodings: // Supported encodings:
// * "protobuf" // * "protobuf"
// * "json" // * "json"
func (_ objectOpts) InputEnc(e string) ObjectPutOption { func (objectOpts) InputEnc(e string) ObjectPutOption {
return func(settings *ObjectPutSettings) error { return func(settings *ObjectPutSettings) error {
settings.InputEnc = e settings.InputEnc = e
return nil return nil
...@@ -96,7 +96,7 @@ func (_ objectOpts) InputEnc(e string) ObjectPutOption { ...@@ -96,7 +96,7 @@ func (_ objectOpts) InputEnc(e string) ObjectPutOption {
// Supported types: // Supported types:
// * "text" (default) // * "text" (default)
// * "base64" // * "base64"
func (_ objectOpts) DataType(t string) ObjectPutOption { func (objectOpts) DataType(t string) ObjectPutOption {
return func(settings *ObjectPutSettings) error { return func(settings *ObjectPutSettings) error {
settings.DataType = t settings.DataType = t
return nil return nil
...@@ -105,7 +105,7 @@ func (_ objectOpts) DataType(t string) ObjectPutOption { ...@@ -105,7 +105,7 @@ func (_ objectOpts) DataType(t string) ObjectPutOption {
// Create is an option for Object.AddLink which specifies whether create required // Create is an option for Object.AddLink which specifies whether create required
// directories for the child // directories for the child
func (_ objectOpts) Create(create bool) ObjectAddLinkOption { func (objectOpts) Create(create bool) ObjectAddLinkOption {
return func(settings *ObjectAddLinkSettings) error { return func(settings *ObjectAddLinkSettings) error {
settings.Create = create settings.Create = create
return nil return nil
......
...@@ -71,31 +71,31 @@ var Pin pinOpts ...@@ -71,31 +71,31 @@ var Pin pinOpts
// All is an option for Pin.Ls which will make it return all pins. It is // All is an option for Pin.Ls which will make it return all pins. It is
// the default // the default
func (_ pinType) All() PinLsOption { func (pinType) All() PinLsOption {
return Pin.pinType("all") return Pin.pinType("all")
} }
// Recursive is an option for Pin.Ls which will make it only return recursive // Recursive is an option for Pin.Ls which will make it only return recursive
// pins // pins
func (_ pinType) Recursive() PinLsOption { func (pinType) Recursive() PinLsOption {
return Pin.pinType("recursive") return Pin.pinType("recursive")
} }
// Direct is an option for Pin.Ls which will make it only return direct (non // Direct is an option for Pin.Ls which will make it only return direct (non
// recursive) pins // recursive) pins
func (_ pinType) Direct() PinLsOption { func (pinType) Direct() PinLsOption {
return Pin.pinType("direct") return Pin.pinType("direct")
} }
// Indirect is an option for Pin.Ls which will make it only return indirect pins // Indirect is an option for Pin.Ls which will make it only return indirect pins
// (objects referenced by other recursively pinned objects) // (objects referenced by other recursively pinned objects)
func (_ pinType) Indirect() PinLsOption { func (pinType) Indirect() PinLsOption {
return Pin.pinType("indirect") return Pin.pinType("indirect")
} }
// Recursive is an option for Pin.Add which specifies whether to pin an entire // Recursive is an option for Pin.Add which specifies whether to pin an entire
// object tree or just one object. Default: true // object tree or just one object. Default: true
func (_ pinOpts) Recursive(recucsive bool) PinAddOption { func (pinOpts) Recursive(recucsive bool) PinAddOption {
return func(settings *PinAddSettings) error { return func(settings *PinAddSettings) error {
settings.Recursive = recucsive settings.Recursive = recucsive
return nil return nil
...@@ -111,7 +111,7 @@ func (_ pinOpts) Recursive(recucsive bool) PinAddOption { ...@@ -111,7 +111,7 @@ func (_ pinOpts) Recursive(recucsive bool) PinAddOption {
// * "indirect" - indirectly pinned objects (referenced by recursively pinned // * "indirect" - indirectly pinned objects (referenced by recursively pinned
// objects) // objects)
// * "all" - all pinned objects (default) // * "all" - all pinned objects (default)
func (_ pinOpts) pinType(t string) PinLsOption { func (pinOpts) pinType(t string) PinLsOption {
return func(settings *PinLsSettings) error { return func(settings *PinLsSettings) error {
settings.Type = t settings.Type = t
return nil return nil
...@@ -120,7 +120,7 @@ func (_ pinOpts) pinType(t string) PinLsOption { ...@@ -120,7 +120,7 @@ func (_ pinOpts) pinType(t string) PinLsOption {
// Unpin is an option for Pin.Update which specifies whether to remove the old pin. // Unpin is an option for Pin.Update which specifies whether to remove the old pin.
// Default is true. // Default is true.
func (_ pinOpts) Unpin(unpin bool) PinUpdateOption { func (pinOpts) Unpin(unpin bool) PinUpdateOption {
return func(settings *PinUpdateSettings) error { return func(settings *PinUpdateSettings) error {
settings.Unpin = unpin settings.Unpin = unpin
return nil return 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