npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redpoll

v1.1.2

Published

redpoll is implement of PEDT specifications in NodeJs.

Downloads

11

Readme

redpoll

redpoll is implement of PEDT - Parallel Exchangeable Distribution Task specifications for NodeJS.

PEDT v1.1 specifications supported.

Table of Contents

install

npm install redpoll

import and usage

var Redpoll = require('redpoll');
var options = {};
var pedt = new Redpoll(options);

pedt.run(...)
	.then(function(result){
		...
	})

options

the full options schema:

options = {
	distributed_request: function(arrResult) { .. }, // a http client implement
    default_rejected: function(message) { .. }, // a default rejected inject
	system_route: { .. }, // any key/value pairs
	task_register_center: {
		download_task: function(taskId) { .. }, // PEDT interface
		register_task: function(taskDef) { .. }  // PEDT interface
	},
	resource_status_center: {
		require: function(resId) {..}	// PEDT interface
	}
}

interfaces

for detail, @see ${readpoll}/infra/specifications/*

all interfaces are promise supported except pedt.upgrade() and helpers.

pedt.run

pedt.run = function(task, args)

run a task (taskId, function or taskObject) with args.

pedt.map

pedt.map = function(distributionScope, taskId, args)

map taskId to distributionScope with args, and get result array.

distributionScope will parse by pedt.require().

pedt.execute_task

pedt.execute_task = function(taskId, args)

run a taskId with args. pedt.run(taskId) will call this.

pedt.register_task

pedt.register_task = function(task)

run a task and return taskId.

the "task" is a taskDef text or local taskObject.

pedt.require

pedt.require = function(token)

require a resource by token. the token is distributionScope or system token, or other.

this is n4c expanded interface, resource query interface emmbedded.

pedt.upgrade

this.upgrade = function(newOptions)

upgrade current Redpoll/PEDT instance with newOptions. @see options

this is redpoll expanded interface.

pedt.LOGGER

this is expanded reserved tokens. it's constant:

LOGGER: "!"

so, you can option/reset/upgrade local default logger in your code:

pedt.upgrade({ system_route: {[pedt.LOGGER]: function(message) {
  console.log(message)
}}});

or disable it:

pedt.upgrade({ system_route: {[pedt.LOGGER]: Promise.resolve(false)}}),

or resend message to remote nodes/scope:

// @see ${redpoll}/testcase/t_executor.js
pedt.register_task(a_task_def).then(set_remote_logger)

and, you can call the logger at anywhere:

pedt.require(pedt.LOGGER).then(function(logger) {
  pedt.run(logger, message)
})

or public a log_print_task, register and run it:

var log_print_task = {
  message: 'will replaced',
  task: def.require(def.LOGGER),
  promised: function(log) {
    return this.run(log.task, log.message))
  }
}
var taskId = '<get result from pedt.register_task(log_print_task)>'
pedt.run(taskId, {message: 'some notice/error information'})

this is redpoll expanded interface.

pedt.TASK_XXX

some task constants, inherited from def.TASK_XXX in Redpoll.infra.taskhelper. include:

TASK_BLANK
TASK_SELF
TASK_RESOURCE

ex:

taskDef = {
  // !! static recursion !!
  x: def.run(def.TASK_SELF, ..), 
  // require local resource
  y: def.require('registed_local_resource_name'),

  promised: function(taskResult) {
    // !! dynamic recursion !!
    this.run(taskResult.taskId, ..);
    // try execute blank task
    this.execute_task(this.TASK_BLANK, {..})
  }
}

this is redpoll expanded interface.

pedt.version

get support version of PEDT specifications, it's string value.

this is redpoll expanded interface.

helpers

some tool/helpers include in the package.

Redpoll.infra.taskhelper

var Redpoll = require('redpoll');
var def = Redpoll.infra.taskhelper;
var taskDef = {
	x: def.run(...),
	y: def.map(...),
	...
}

a taskDef define helper. @see:

$(redpoll)/testcase/t_executor.js

Redpoll.infra.httphelper

var Redpoll = require('redpoll');
var options = {
	...,
	distributed_request = Redpoll.infra.httphelper.distributed_request
}

a recommented/standard distributed request.

Redpoll.infra.requestdata

var Redpoll = require('redpoll');
var request_parse = Redpoll.infra.requestdata.parse;

...
require("http").createServer(function(request, response) {
	var params = request_parse(request);
	...
}

a requestdata parser for http server/daemon, PEDT standard requests supported. @see:

$(redpoll)/testcase/executor.js

testcase

try these:

> git clone 'https://github.com/aimingoo/redpoll'
> cd redpoll
> npm install
> node testcase/t_executor.js

> #(start new shell and continue)
> curl -s 'http://127.0.0.1:8032/redpoll/execute_task:c2eb2597e461aa3aa0e472f52e92fe0b'

history

2015.12.04	v1.1.2 released.
	- minor udpate
2015.11.28	v1.1.0 released.
	- recursion taskDef supported, def.TASK_SELF point to self.
	- def.require() supported, and other def.XXX constants published.
	- standard logger and rejected inject.
	- taskDef.rejected supported.
    - "taskId" field for taskOrder/taskResult supported.
2015.11.07	v1.0.0 released.