Documentation ¶
Index ¶
- Variables
- func ListIpAdresses() ([]maddr.Multiaddr, error)
- func NewChannelBool() *safeChannelBool
- func NewChannelString() *safeChannelString
- func NewNewLogger(quiet bool) func(string, int, int) (func(string), error)
- func NewSafeWaitgroupTwice(n int, m int) *safeWaitgroupTwice
- func NewStandardInterface(additionalHandler ...func() error) standardFunctionsCloser
- func ResetReader(received int, sent []interface{}, sendToRemote func(interface{}), ...) (readFromRemote func(string))
- type BasicExtHost
- func (h *BasicExtHost) Addrs() []maddr.Multiaddr
- func (h *BasicExtHost) Check() bool
- func (h *BasicExtHost) Close() error
- func (h *BasicExtHost) ConnManager() connmgr.ConnManager
- func (h *BasicExtHost) Connect(ctx context.Context, pi peer.AddrInfo) error
- func (h *BasicExtHost) EventBus() event.Bus
- func (h *BasicExtHost) ID() peer.ID
- func (h *BasicExtHost) Listen(pid protocol.ID, rendezvous string)
- func (h *BasicExtHost) Mux() protocol.Switch
- func (h *BasicExtHost) Network() network.Network
- func (h *BasicExtHost) NewPeer(base protocol.ID) (peer.ID, error)
- func (h *BasicExtHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error)
- func (h *BasicExtHost) Peerstore() peerstore.Peerstore
- func (h *BasicExtHost) PeerstoreProtocol(base protocol.ID) (peerstore.Peerstore, error)
- func (h *BasicExtHost) Raise(err error)
- func (h *BasicExtHost) RemoveStreamHandler(pid protocol.ID)
- func (h *BasicExtHost) SelfStream(pid ...protocol.ID) (SelfStream, error)
- func (h *BasicExtHost) SetCloseHandler(handler func())
- func (h *BasicExtHost) SetErrorHandler(handler func(error))
- func (h *BasicExtHost) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)
- func (h *BasicExtHost) SetStreamHandlerMatch(pid protocol.ID, match func(string) bool, handler network.StreamHandler)
- type BasicFunctionsCloser
- type BasicMasterComm
- func (c *BasicMasterComm) Check() bool
- func (c *BasicMasterComm) Close() error
- func (c *BasicMasterComm) Raise(err error)
- func (c *BasicMasterComm) Reset(i int, slaveId int)
- func (c *BasicMasterComm) SetCloseHandler(handler func())
- func (c *BasicMasterComm) SetErrorHandler(handler func(error))
- func (c *BasicMasterComm) SlaveComm() SlaveComm
- type BasicMpi
- func (m *BasicMpi) Add(file string) error
- func (m *BasicMpi) Check() bool
- func (m *BasicMpi) Close() error
- func (m *BasicMpi) Del(f string) error
- func (m *BasicMpi) Get(maxsize uint64) error
- func (m *BasicMpi) Host() ExtHost
- func (m *BasicMpi) Raise(err error)
- func (m *BasicMpi) SetCloseHandler(handler func())
- func (m *BasicMpi) SetErrorHandler(handler func(error))
- func (m *BasicMpi) SetInitFunctions(...)
- func (m *BasicMpi) Start(file string, n int, args ...string) (err error)
- func (m *BasicMpi) Store() Store
- type BasicRemote
- func (r *BasicRemote) Check() bool
- func (r *BasicRemote) Close() error
- func (r *BasicRemote) CloseRemote()
- func (r *BasicRemote) Get() string
- func (r *BasicRemote) Raise(err error)
- func (r *BasicRemote) RequestReset(i int, slaveId int)
- func (r *BasicRemote) Reset(stream io.ReadWriteCloser, slaveId int, msgs ...interface{})
- func (r *BasicRemote) Send(msg string)
- func (r *BasicRemote) SendHandshake()
- func (r *BasicRemote) SetCloseHandler(handler func())
- func (r *BasicRemote) SetErrorHandler(handler func(error))
- func (r *BasicRemote) SetPingInterval(interval time.Duration)
- func (r *BasicRemote) SetPingTimeout(timeoutDuration time.Duration)
- func (r *BasicRemote) SetResetHandler(handler func(int, int))
- func (r *BasicRemote) SlaveId() int
- func (r *BasicRemote) Stream() io.ReadWriteCloser
- func (r *BasicRemote) WaitHandshake()
- type BasicSlaveComm
- func (c *BasicSlaveComm) Check() bool
- func (c *BasicSlaveComm) Close() error
- func (c *BasicSlaveComm) Connect(i int, addr peer.ID, msgs ...interface{}) error
- func (c *BasicSlaveComm) Host() ExtHost
- func (c *BasicSlaveComm) Interface() Interface
- func (c *BasicSlaveComm) Protocol() protocol.ID
- func (c *BasicSlaveComm) Raise(err error)
- func (c *BasicSlaveComm) Remote(idx int) Remote
- func (c *BasicSlaveComm) RequestReset(i int)
- func (c *BasicSlaveComm) SetCloseHandler(handler func())
- func (c *BasicSlaveComm) SetErrorHandler(handler func(error))
- func (c *BasicSlaveComm) Start()
- type CloseableBuffer
- func (b *CloseableBuffer) Close() error
- func (b *CloseableBuffer) Conn() network.Conn
- func (b *CloseableBuffer) Protocol() protocol.ID
- func (b *CloseableBuffer) Read(p []byte) (int, error)
- func (b *CloseableBuffer) Reset() error
- func (b *CloseableBuffer) Reverse() (SelfStream, error)
- func (b *CloseableBuffer) SetDeadline(t time.Time) error
- func (b *CloseableBuffer) SetProtocol(pid protocol.ID)
- func (b *CloseableBuffer) SetReadDeadline(t time.Time) error
- func (b *CloseableBuffer) SetWriteDeadline(t time.Time) error
- func (b *CloseableBuffer) Stat() network.Stat
- func (b *CloseableBuffer) Write(p []byte) (int, error)
- type Config
- type ExtHost
- type Interface
- type IpfsShell
- func (s *IpfsShell) Add(f string)
- func (s *IpfsShell) Check() bool
- func (s *IpfsShell) Close() error
- func (s *IpfsShell) Del(f string, failed bool) error
- func (s *IpfsShell) Dowload(f string) error
- func (s *IpfsShell) Get(maxSize uint64) (string, error)
- func (s *IpfsShell) Has(f string) bool
- func (s *IpfsShell) List() []string
- func (s *IpfsShell) Occupied() (uint64, error)
- func (s *IpfsShell) Raise(err error)
- func (s *IpfsShell) SetCloseHandler(handler func())
- func (s *IpfsShell) SetErrorHandler(handler func(error))
- type MasterComm
- type Mpi
- type Param
- type Remote
- type SelfStream
- type SlaveComm
- type StdInterface
- func (s *StdInterface) Check() bool
- func (s *StdInterface) Close() error
- func (s *StdInterface) Push(msg string) error
- func (s *StdInterface) Raise(err error)
- func (s *StdInterface) SetCloseHandler(handler func())
- func (s *StdInterface) SetErrorHandler(handler func(error))
- func (s *StdInterface) SetLogger(handler func(string))
- func (s *StdInterface) SetMessageHandler(handler func(int, string))
- func (s *StdInterface) SetRequestHandler(handler func(int))
- func (s *StdInterface) SetResetHandler(handler func(int))
- func (s *StdInterface) Start()
- type Store
- type StreamHandlerMatcher
Constants ¶
This section is empty.
Variables ¶
View Source
var ( HostHeader = "Host" HostLogger = log.Logger(HostHeader) LookUpInterval = 45 * time.Second )
View Source
var ( InterfaceHeader = "Interface" InterfaceLogger = log.Logger(InterfaceHeader) HeaderNotUnderstood = errors.New("Header not understood") CommandNotUnderstood = errors.New("Command not understood") //NotMatserComm = errors.New("Not the MasterComm") NotEnoughFields = errors.New("Not enough field") EmptyString = errors.New("Received an empty string") InterfaceLogHeader = "Log" InterfaceSendHeader = "Send" InterfaceResetHeader = "Reset" InterfaceRequestHeader = "Req" LogSubFormat = "%s %d/%d" )
View Source
var ( IpfsHeader = "IpfsStore" IpfsLogger = log.Logger(IpfsHeader) ModePerm os.FileMode = 0777 InstalledHeader = "installed/" FailedHeader = "failed/" )
View Source
var ( MasterCommHeader = "MasterComm" MasterLogger = log.Logger(MasterCommHeader) ResetCooldown = 2 * time.Second )
View Source
var ( MpiHeader = "Mpi" MpiLogger = log.Logger(MpiHeader) ThrottleDuration = 50 * time.Millisecond )
View Source
var ( RemoteHeader = "Remote" RemoteLogger = log.Logger(RemoteHeader) //ResetHandShakeHeader = "ResetHandShake" PingRespHeader = "PingResp" HandShakeHeader = "HandShake" MessageHeader = "Msg" CloseHeader = "Close" PingHeader = "Ping" ResetHeader = "Reset" StandardTimeout = 2 * time.Second //Will be increase later StandardPingInterval = 200 * time.Millisecond //Will be increase later NilStreamError = errors.New("nil stream") ErrorInterval = 4 * time.Second )
View Source
var ( StreamHeader = "SelfStream" StreamEnded = errors.New("Stream closed") StandardCheckingInterval = 300 * time.Millisecond )
View Source
var ( SlaveCommHeader = "SlaveComm" SlaveLogger = log.Logger(SlaveCommHeader) )
Functions ¶
func ListIpAdresses ¶
func NewChannelBool ¶
func NewChannelBool() *safeChannelBool
func NewChannelString ¶
func NewChannelString() *safeChannelString
func NewSafeWaitgroupTwice ¶
func NewStandardInterface ¶
func NewStandardInterface(additionalHandler ...func() error) standardFunctionsCloser
func ResetReader ¶
Types ¶
type BasicExtHost ¶
type BasicExtHost struct { Ctx context.Context Host host.Host StreamHandlers sync.Map Routing *discovery.RoutingDiscovery PeerStores map[protocol.ID]peerstore.Peerstore Standard standardFunctionsCloser }
func (*BasicExtHost) Addrs ¶
func (h *BasicExtHost) Addrs() []maddr.Multiaddr
func (*BasicExtHost) Check ¶
func (h *BasicExtHost) Check() bool
func (*BasicExtHost) Close ¶
func (h *BasicExtHost) Close() error
func (*BasicExtHost) ConnManager ¶
func (h *BasicExtHost) ConnManager() connmgr.ConnManager
func (*BasicExtHost) EventBus ¶
func (h *BasicExtHost) EventBus() event.Bus
func (*BasicExtHost) ID ¶
func (h *BasicExtHost) ID() peer.ID
func (*BasicExtHost) Mux ¶
func (h *BasicExtHost) Mux() protocol.Switch
func (*BasicExtHost) Network ¶
func (h *BasicExtHost) Network() network.Network
func (*BasicExtHost) Peerstore ¶
func (h *BasicExtHost) Peerstore() peerstore.Peerstore
func (*BasicExtHost) PeerstoreProtocol ¶
func (*BasicExtHost) Raise ¶
func (h *BasicExtHost) Raise(err error)
func (*BasicExtHost) RemoveStreamHandler ¶
func (h *BasicExtHost) RemoveStreamHandler(pid protocol.ID)
func (*BasicExtHost) SelfStream ¶
func (h *BasicExtHost) SelfStream(pid ...protocol.ID) (SelfStream, error)
func (*BasicExtHost) SetCloseHandler ¶
func (h *BasicExtHost) SetCloseHandler(handler func())
func (*BasicExtHost) SetErrorHandler ¶
func (h *BasicExtHost) SetErrorHandler(handler func(error))
func (*BasicExtHost) SetStreamHandler ¶
func (h *BasicExtHost) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)
func (*BasicExtHost) SetStreamHandlerMatch ¶
func (h *BasicExtHost) SetStreamHandlerMatch(pid protocol.ID, match func(string) bool, handler network.StreamHandler)
type BasicFunctionsCloser ¶
type BasicFunctionsCloser struct { Mutex sync.Mutex Ended bool EndHandler *func() AdditionalHandler []func() error ErrorHandler *func(error) }
func (*BasicFunctionsCloser) Check ¶
func (b *BasicFunctionsCloser) Check() bool
func (*BasicFunctionsCloser) Close ¶
func (b *BasicFunctionsCloser) Close() error
func (*BasicFunctionsCloser) Raise ¶
func (b *BasicFunctionsCloser) Raise(err error)
func (*BasicFunctionsCloser) SetCloseHandler ¶
func (b *BasicFunctionsCloser) SetCloseHandler(handler func())
func (*BasicFunctionsCloser) SetErrorHandler ¶
func (b *BasicFunctionsCloser) SetErrorHandler(handler func(error))
type BasicMasterComm ¶
type BasicMasterComm struct { Mutex sync.Mutex Param Param Ctx context.Context Comm SlaveComm Standard standardFunctionsCloser }
func (*BasicMasterComm) Check ¶
func (c *BasicMasterComm) Check() bool
func (*BasicMasterComm) Close ¶
func (c *BasicMasterComm) Close() error
func (*BasicMasterComm) Raise ¶
func (c *BasicMasterComm) Raise(err error)
func (*BasicMasterComm) Reset ¶
func (c *BasicMasterComm) Reset(i int, slaveId int)
func (*BasicMasterComm) SetCloseHandler ¶
func (c *BasicMasterComm) SetCloseHandler(handler func())
func (*BasicMasterComm) SetErrorHandler ¶
func (c *BasicMasterComm) SetErrorHandler(handler func(error))
func (*BasicMasterComm) SlaveComm ¶
func (c *BasicMasterComm) SlaveComm() SlaveComm
type BasicMpi ¶
type BasicMpi struct { ToClose sync.Map Ctx context.Context Pid protocol.ID Maxsize uint64 Path string Ipfs_store string MpiHost ExtHost MpiStore Store Id safeInt Standard standardFunctionsCloser NewSlaveComm func(context.Context, ExtHost, io.ReadWriteCloser, protocol.ID, Param, Interface, []Remote) (SlaveComm, error) NewMasterSlaveComm func(context.Context, ExtHost, protocol.ID, Param, Interface, []Remote) (SlaveComm, error) NewMasterComm func(context.Context, SlaveComm, Param) (MasterComm, error) NewInterface func(ctx context.Context, file string, n int, i int, args ...string) (Interface, error) NewRemote func(context.Context, int) (Remote, error) NewLogger func(string, int, int) (func(string), error) }
func (*BasicMpi) SetCloseHandler ¶
func (m *BasicMpi) SetCloseHandler(handler func())
func (*BasicMpi) SetErrorHandler ¶
func (*BasicMpi) SetInitFunctions ¶
func (m *BasicMpi) SetInitFunctions( newSlaveComm func(context.Context, ExtHost, io.ReadWriteCloser, protocol.ID, Param, Interface, []Remote) (SlaveComm, error), newMasterSlaveComm func(context.Context, ExtHost, protocol.ID, Param, Interface, []Remote) (SlaveComm, error), newMasterComm func(context.Context, SlaveComm, Param) (MasterComm, error), newInterface func(context.Context, string, int, int, ...string) (Interface, error), newRemote func(context.Context, int) (Remote, error), newLogger func(string, int, int) (func(string), error))
type BasicRemote ¶
type BasicRemote struct { Mutex sync.Mutex ReadChan *safeChannelString HandshakeChan *safeChannelBool SendChan *safeChannelString Ctx context.Context Id int ResetHandler *func(int, int) PingInterval time.Duration PingTimeout time.Duration Sent []interface{} Rw io.ReadWriteCloser Received int Standard standardFunctionsCloser }
func (*BasicRemote) Check ¶
func (r *BasicRemote) Check() bool
func (*BasicRemote) Close ¶
func (r *BasicRemote) Close() error
func (*BasicRemote) CloseRemote ¶
func (r *BasicRemote) CloseRemote()
func (*BasicRemote) Get ¶
func (r *BasicRemote) Get() string
func (*BasicRemote) Raise ¶
func (r *BasicRemote) Raise(err error)
func (*BasicRemote) RequestReset ¶
func (r *BasicRemote) RequestReset(i int, slaveId int)
func (*BasicRemote) Reset ¶
func (r *BasicRemote) Reset(stream io.ReadWriteCloser, slaveId int, msgs ...interface{})
func (*BasicRemote) Send ¶
func (r *BasicRemote) Send(msg string)
func (*BasicRemote) SendHandshake ¶
func (r *BasicRemote) SendHandshake()
func (*BasicRemote) SetCloseHandler ¶
func (r *BasicRemote) SetCloseHandler(handler func())
func (*BasicRemote) SetErrorHandler ¶
func (r *BasicRemote) SetErrorHandler(handler func(error))
func (*BasicRemote) SetPingInterval ¶
func (r *BasicRemote) SetPingInterval(interval time.Duration)
func (*BasicRemote) SetPingTimeout ¶
func (r *BasicRemote) SetPingTimeout(timeoutDuration time.Duration)
func (*BasicRemote) SetResetHandler ¶
func (r *BasicRemote) SetResetHandler(handler func(int, int))
func (*BasicRemote) SlaveId ¶
func (r *BasicRemote) SlaveId() int
func (*BasicRemote) Stream ¶
func (r *BasicRemote) Stream() io.ReadWriteCloser
func (*BasicRemote) WaitHandshake ¶
func (r *BasicRemote) WaitHandshake()
type BasicSlaveComm ¶
type BasicSlaveComm struct { SlaveIdMutex sync.Mutex RemotesMutex sync.Mutex Param Param Ctx context.Context Inter Interface CommHost ExtHost Base protocol.ID Remotes []Remote Standard standardFunctionsCloser }
func (*BasicSlaveComm) Check ¶
func (c *BasicSlaveComm) Check() bool
func (*BasicSlaveComm) Close ¶
func (c *BasicSlaveComm) Close() error
func (*BasicSlaveComm) Connect ¶
func (c *BasicSlaveComm) Connect(i int, addr peer.ID, msgs ...interface{}) error
func (*BasicSlaveComm) Host ¶
func (c *BasicSlaveComm) Host() ExtHost
func (*BasicSlaveComm) Interface ¶
func (c *BasicSlaveComm) Interface() Interface
func (*BasicSlaveComm) Protocol ¶
func (c *BasicSlaveComm) Protocol() protocol.ID
func (*BasicSlaveComm) Raise ¶
func (c *BasicSlaveComm) Raise(err error)
func (*BasicSlaveComm) Remote ¶
func (c *BasicSlaveComm) Remote(idx int) Remote
func (*BasicSlaveComm) RequestReset ¶
func (c *BasicSlaveComm) RequestReset(i int)
func (*BasicSlaveComm) SetCloseHandler ¶
func (c *BasicSlaveComm) SetCloseHandler(handler func())
func (*BasicSlaveComm) SetErrorHandler ¶
func (c *BasicSlaveComm) SetErrorHandler(handler func(error))
func (*BasicSlaveComm) Start ¶
func (c *BasicSlaveComm) Start()
type CloseableBuffer ¶
type CloseableBuffer struct { WritePipe *io.PipeWriter ReadPipe *io.PipeReader WritePipeReversed *io.PipeWriter ReadPipeReversed *io.PipeReader WriteTimeout time.Duration ReadTimeout time.Duration Ended bool Mutex sync.Mutex Pid protocol.ID }
func (*CloseableBuffer) Close ¶
func (b *CloseableBuffer) Close() error
func (*CloseableBuffer) Conn ¶
func (b *CloseableBuffer) Conn() network.Conn
func (*CloseableBuffer) Protocol ¶
func (b *CloseableBuffer) Protocol() protocol.ID
func (*CloseableBuffer) Reset ¶
func (b *CloseableBuffer) Reset() error
func (*CloseableBuffer) Reverse ¶
func (b *CloseableBuffer) Reverse() (SelfStream, error)
func (*CloseableBuffer) SetDeadline ¶
func (b *CloseableBuffer) SetDeadline(t time.Time) error
func (*CloseableBuffer) SetProtocol ¶
func (b *CloseableBuffer) SetProtocol(pid protocol.ID)
func (*CloseableBuffer) SetReadDeadline ¶
func (b *CloseableBuffer) SetReadDeadline(t time.Time) error
func (*CloseableBuffer) SetWriteDeadline ¶
func (b *CloseableBuffer) SetWriteDeadline(t time.Time) error
func (*CloseableBuffer) Stat ¶
func (b *CloseableBuffer) Stat() network.Stat
type ExtHost ¶
type Interface ¶
type IpfsShell ¶
type IpfsShell struct { Shell *shell.Shell Store []string Accessible []object Failed []string Path string IpfsStore string Standard standardFunctionsCloser }
func (*IpfsShell) SetCloseHandler ¶
func (s *IpfsShell) SetCloseHandler(handler func())
func (*IpfsShell) SetErrorHandler ¶
type MasterComm ¶
type MasterComm interface { SlaveComm() SlaveComm Reset(idx int, ith_time int) // contains filtered or unexported methods }
func NewMasterComm ¶
type Mpi ¶
type Mpi interface { SetInitFunctions( newSlaveComm func(context.Context, ExtHost, io.ReadWriteCloser, protocol.ID, Param, Interface, []Remote) (SlaveComm, error), newMasterSlaveComm func(context.Context, ExtHost, protocol.ID, Param, Interface, []Remote) (SlaveComm, error), newMasterComm func(context.Context, SlaveComm, Param) (MasterComm, error), newInterface func(context.Context, string, int, int, ...string) (Interface, error), newRemote func(context.Context, int) (Remote, error), newLogger func(string, int, int) (func(string), error), ) Add(string) error Del(string) error Get(uint64) error Host() ExtHost Store() Store Start(string, int, ...string) error // contains filtered or unexported methods }
type Param ¶
func ParamFromString ¶
type Remote ¶
type Remote interface { SlaveId() int SetResetHandler(func(int, int)) RequestReset(int, int) CloseRemote() SetPingInterval(time.Duration) SetPingTimeout(time.Duration) Stream() io.ReadWriteCloser Reset(stream io.ReadWriteCloser, slaveId int, msgs ...interface{}) Get() string WaitHandshake() Send(string) SendHandshake() // contains filtered or unexported methods }
type SelfStream ¶
type SelfStream interface { Reverse() (SelfStream, error) network.Stream }
func NewStream ¶
func NewStream(pid protocol.ID) SelfStream
type SlaveComm ¶
type SlaveComm interface { Protocol() protocol.ID RequestReset(int) Start() Host() ExtHost Interface() Interface Remote(int) Remote Connect(int, peer.ID, ...interface{}) error // contains filtered or unexported methods }
func NewMasterSlaveComm ¶
type StdInterface ¶
type StdInterface struct { Ctx context.Context Stdin io.Writer MessageHandler *func(int, string) RequestHandler *func(int) ResetHandler *func(int) Logger *func(string) Idx int Cmd *exec.Cmd Standard standardFunctionsCloser }
func (*StdInterface) Check ¶
func (s *StdInterface) Check() bool
func (*StdInterface) Close ¶
func (s *StdInterface) Close() error
func (*StdInterface) Push ¶
func (s *StdInterface) Push(msg string) error
func (*StdInterface) Raise ¶
func (s *StdInterface) Raise(err error)
func (*StdInterface) SetCloseHandler ¶
func (s *StdInterface) SetCloseHandler(handler func())
func (*StdInterface) SetErrorHandler ¶
func (s *StdInterface) SetErrorHandler(handler func(error))
func (*StdInterface) SetLogger ¶
func (s *StdInterface) SetLogger(handler func(string))
func (*StdInterface) SetMessageHandler ¶
func (s *StdInterface) SetMessageHandler(handler func(int, string))
func (*StdInterface) SetRequestHandler ¶
func (s *StdInterface) SetRequestHandler(handler func(int))
func (*StdInterface) SetResetHandler ¶
func (s *StdInterface) SetResetHandler(handler func(int))
func (*StdInterface) Start ¶
func (s *StdInterface) Start()
type Store ¶
type StreamHandlerMatcher ¶
type StreamHandlerMatcher struct { Match func(string) bool Handler network.StreamHandler }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.