GithubHelp home page GithubHelp logo

happy-ferret / go-ezipc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cmcoffee/go-ezipc

0.0 2.0 0.0 33 KB

Simple Inter-Process Communication (IPC) Messaging Library for Go. (golang ipc)

License: MIT License

Go 100.00%

go-ezipc's Introduction

ezipc

import "github.com/cmcoffee/go-ezipc"

Package ezipc provides a simple framework to allow for communication between multiple background processes.

EzIPC has similar requirements for exporting functions that Go's native "rpc" package provides, however ezipc maps both functions and object methods.

1)the method or function requires two arguments, both exported (or builtin) types.
2)the method or function's second argument is a pointer.
3)the method or function has a return type of error.

Registered methods or functions should look like:

func (*T) Name(argType T1, replyType *T2) error

and respectively ...

func name(argType T1, replyType *T2) error

Exported functions & methods should be made thread safe.

Variables

var ErrClosed = errors.New("Connection closed.")
var ErrFail = errors.New("Call failed.")

type EzIPC

type EzIPC struct {
    // contains filtered or unexported fields
}

EzIPC is common to both IPC clients and servers.

func New

func New() *EzIPC

Creates a new ezipc router.

func (*EzIPC) Call

func (e *EzIPC) Call(name string, arg interface{}, reply interface{}) (err error)

Call invokes a registered method/function, blocks while actively checking for for completion, returns err on failure.

func (*EzIPC) Dial

func (e *EzIPC) Dial(socketf string) error

Dial is the client function of EzIPC, it opens a connection to the socket file.

func (*EzIPC) Listen

func (e *EzIPC) Listen(socketf string) (err error)

Listens is the server function of EzIPC, it opens a connection and blocks while listening for requests.

func (*EzIPC) Register

func (e *EzIPC) Register(fptr interface{}) error

Registers local methods or function, informs Broker of registration. Function/method template should follow: func name(argType T1, replyType *T2) error func (*T) Name(argType T1, replyType *T2) error

func (*EzIPC) RegisterName

func (e *EzIPC) RegisterName(name string, fptr interface{}) (err error)

RegisterName operates exactly as Register but allows changing the name of the object or function.


Generated by godoc2md

go-ezipc's People

Contributors

cmcoffee avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.