OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / vendor / github.com / bytom / protocol / bc / mux.go
diff --git a/vendor/github.com/bytom/protocol/bc/mux.go b/vendor/github.com/bytom/protocol/bc/mux.go
new file mode 100644 (file)
index 0000000..9a99820
--- /dev/null
@@ -0,0 +1,21 @@
+package bc
+
+import "io"
+
+// Mux splits and combines value from one or more source entries,
+// making it available to one or more destination entries. It
+// satisfies the Entry interface.
+
+func (Mux) typ() string { return "mux1" }
+func (m *Mux) writeForHash(w io.Writer) {
+       mustWriteForHash(w, m.Sources)
+       mustWriteForHash(w, m.Program)
+}
+
+// NewMux creates a new Mux.
+func NewMux(sources []*ValueSource, program *Program) *Mux {
+       return &Mux{
+               Sources: sources,
+               Program: program,
+       }
+}