@cryptotaxi247 / kubo / commits / 738f1824f

docs for core/core method impls

License: MIT Signed-off-by: ForrestWeston <forrest@protocol.ai>

ForrestWeston committed Jan 22, 2018 at 14:42 UTC 738f1824f2ecd856e9ec902bfc07689a04706d18
1 file changed +7
core/core.go
+7
@@ -420,6 +420,8 @@ func setupDiscoveryOption(d config.Discovery) DiscoveryOption {
420 return nil
421 }
422
423 +// HandlePeerFound attempts to connect to peer from `PeerInfo`, if it fails
424 +// logs a warning log.
425 func (n *IpfsNode) HandlePeerFound(p pstore.PeerInfo) {
426 log.Warning("trying peer info: ", p)
427 ctx, cancel := context.WithTimeout(n.Context(), discoveryConnTimeout)
@@ -590,6 +592,7 @@ func (n *IpfsNode) teardown() error {
592 return nil
593 }
594
595 +// OnlineMode returns whether or not the IpfsNode is in OnlineMode.
596 func (n *IpfsNode) OnlineMode() bool {
597 switch n.mode {
598 case onlineMode:
@@ -599,6 +602,7 @@ func (n *IpfsNode) OnlineMode() bool {
602 }
603 }
604
605 +// SetLocal will set the IpfsNode to local mode
606 func (n *IpfsNode) SetLocal(isLocal bool) {
607 if isLocal {
608 n.mode = localMode
@@ -606,6 +610,7 @@ func (n *IpfsNode) SetLocal(isLocal bool) {
610 n.localModeSet = true
611 }
612
613 +// LocalMode returns whether or not the IpfsNode is in LocalMode
614 func (n *IpfsNode) LocalMode() bool {
615 if !n.localModeSet {
616 // programmer error should not happen
@@ -619,6 +624,7 @@ func (n *IpfsNode) LocalMode() bool {
624 }
625 }
626
627 +// Bootstrap will set and call the IpfsNodes bootstrap function.
628 func (n *IpfsNode) Bootstrap(cfg BootstrapConfig) error {
629
630 // TODO what should return value be when in offlineMode?
@@ -670,6 +676,7 @@ func (n *IpfsNode) loadID() error {
676 return nil
677 }
678
679 +// GetKey will return a key from the Keystore with name `name`.
680 func (n *IpfsNode) GetKey(name string) (ic.PrivKey, error) {
681 if name == "self" {
682 return n.PrivateKey, nil