Giter Site home page Giter Site logo

matzes / dart_rmi Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 162 KB

Remote Method Invocation without reflection

Home Page: https://pub.dartlang.org/packages/rmi

License: BSD 2-Clause "Simplified" License

Dart 98.31% Shell 1.69%
dart rmi code-generation proxy invoker

dart_rmi's Introduction

Remote Method Invocation for dart

Build Status

This project provides an solution for remote method invocation in dart without the use of reflection. Since reflection is only available on the Dart VM but not on a JS VM, this solution is entirely based on code generation instead.

Getting Started

Let's say you want to invoke methods of an ExampleClass looking like this:

// in example.dart
part 'example.g.dart';
class ExampleClass implements RmiTarget {
  void someMethod() {
	print('some stuff');
  }

  ExampleClass();
  // required boilerplate for code generation
  @override
  Object invoke(Invocation invocation) =>
      _$ExampleClassInvoker.invoke(invocation, this);
  factory ExampleClass.getRemote(Context context, String uuid) =>
      _$ExampleClassRmi.getRemote(context, uuid);
  Provision provideRemote(Context context) =>
      _$ExampleClassRmi.provideRemote(context, this);
}

And you have the actual object present on machine A:

ExampleClass exampleObject = new ExampleClass();
/// ...setup some network connection, get a Stream and a StreamSink from it
Stream input = ...
StreamSink output = ...
Provision provision = exampleObject.provideRemote(new Context(input, output));
/// provision contains the uuid which identifies the object on this machine

On machine B:

/// Again we have the input and output you get from your network 
/// and additionally you have to provide the uuid from before
Stream input = ...
StreamSink output = ...
String uuid = ... provision.uuid // from above
ExampleClass remoteObject = ExampleClass.getRemote(new Context(input, output), uuid);
remoteObject.someMethod(); // prints 'some stuff' on the other machine

TODO

  • generator warning when no factory was implemented
  • also for part ...
  • not invocable, not proxied method annotation
  • operators
  • think about object methods, tostring hashcode
  • check lang spec for other members what else could be here
  • Serialize exceptions
  • send stack on exception
  • Add else clause to invoker to provide an error message
  • write doc
  • cleanup exports
  • write install script
  • if static getRemoteis not specified, do not write it for stub constructors simply put a waringing
  • STREAMS!!!!
  • thorw exceptions from invoke
  • Proxy does implement, extend should be possible
  • sosuchmethod...
  • reduce tests to a minimum code
  • warn on rmi non future method
  • warn for contrast metadata
  • class hierarchy metadata
  • pass stream and future null arguments

dart_rmi's People

Contributors

matzes avatar

Stargazers

 avatar  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.