clockwork

package module
v0.0.0-...-fe43aa5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

README

clockwork

GoDoc
Build Status
Coverage Status
License

clockwork extends base cogger to add named cogs with dependency lists. clockwork also contains functionality to do a graph topological sort to determine what order to call the cogs in. It currently calls all cogs in a series but is being upgraded to call all cogs that can be in parallel.

Usage

package main

import (
	"gopkg.in/cogger/cogger.v1/cogs"
	"github.com/cogger/clockwork"
	"github.com/cogger/clockwork/spring"
	"golang.org/x/net/context"
)

func init() {
	keySprng := spring.New("a",cogs.NoOp,"b","c")
	
	clockwork.Add(keySprng)
	clockwork.AddCog("b",cogs.NoOp())
	clockwork.AddCog("c",cogs.NoOp(),"b")

	cog, err := clockwork.Wind(context.Background(),keySprng)
	...	
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(sprng spring.Spring) spring.Spring

Add addes a spring to the clockwork assessembly

func AddCog

func AddCog(name string, cog cogger.Cog, dependsOn ...string) spring.Spring

AddCog addes a cog to the clockwork assessembly

func Clear

func Clear()

Clear clears the clockwork assessembly of all springs

func Get

func Get(name string) (spring.Spring, error)

Get gets a spring from the clockwork assessembly by name

func MustGet

func MustGet(name string) spring.Spring

MustGet panics if it can not get the spring from the clockwork assessembly

func Names

func Names() []string

Names returns the list of names of the springs in the clockwork assessembly

func Wind

func Wind(ctx context.Context, sprng spring.Spring) (cogger.Cog, error)

Wind resolves all the dependencies and returns a single cog.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL