Documentation ¶
Index ¶
- Constants
- type Graph
- func (graph *Graph[E]) AddEdge(from, to string)
- func (graph *Graph[E]) AddVertex(name string, elem E)
- func (graph *Graph[E]) Check() error
- func (graph *Graph[E]) Optimize()
- func (graph *Graph[E]) Scheduling() (todo <-chan []*GraphVertex[E], done chan<- []*GraphVertex[E])
- func (graph *Graph[E]) Steps() ([][]string, []string)
- type GraphEdge
- type GraphMarshaler
- type GraphVertex
- type Mapper
- type WorkParams
- type Worker
- type WorkerCache
- type WorkerPool
Constants ¶
View Source
const ( StatusTodo = iota StatusDoing StatusDone )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph[E any] struct { Vertices map[string]*GraphVertex[E] Edges map[GraphEdge[E]]bool Heads []*GraphVertex[E] SerialGroups map[string][]*GraphVertex[E] DoingMap map[string]struct{} ScheduleNum int sync.Mutex }
func MapToNewGraph ¶
func (*Graph[E]) Scheduling ¶
func (graph *Graph[E]) Scheduling() (todo <-chan []*GraphVertex[E], done chan<- []*GraphVertex[E])
type GraphEdge ¶
type GraphEdge[E any] struct { From *GraphVertex[E] To *GraphVertex[E] }
type GraphMarshaler ¶
func NewGraphMarshaler ¶
func NewGraphMarshaler[E any](graph *Graph[E]) *GraphMarshaler[E]
func (GraphMarshaler[E]) GenerateGraph ¶
func (marshaler GraphMarshaler[E]) GenerateGraph() *Graph[E]
type GraphVertex ¶
type GraphVertex[E any] struct { Name string Status int Elem E Dependencies []*GraphVertex[E] Next []*GraphVertex[E] }
type WorkParams ¶
type WorkerCache ¶
func (*WorkerCache) Get ¶
func (cache *WorkerCache) Get() (*Worker, bool)
func (*WorkerCache) Put ¶
func (cache *WorkerCache) Put(worker *Worker) bool
func (*WorkerCache) Reset ¶
func (cache *WorkerCache) Reset()
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
func NewWorkerPool ¶
func NewWorkerPool(cacheSize int) *WorkerPool
func (*WorkerPool) Get ¶
func (pool *WorkerPool) Get() (*Worker, bool)
func (*WorkerPool) Put ¶
func (pool *WorkerPool) Put(worker *Worker)
func (*WorkerPool) Reset ¶
func (pool *WorkerPool) Reset()
Click to show internal directories.
Click to hide internal directories.