This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add four new components: balancer, cdn, dns, html
- Loading branch information
Showing
34 changed files
with
312 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package draft | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/emicklei/dot" | ||
"github.com/lucasepe/draft/pkg/cluster" | ||
"github.com/lucasepe/draft/pkg/node" | ||
) | ||
|
||
type balancer struct { | ||
seq int16 | ||
} | ||
|
||
func (rcv *balancer) nextID() string { | ||
rcv.seq++ | ||
return fmt.Sprintf("lb%d", rcv.seq) | ||
} | ||
|
||
func (rcv *balancer) sketch(graph *dot.Graph, comp Component) { | ||
id := comp.ID | ||
if strings.TrimSpace(comp.ID) == "" { | ||
id = rcv.nextID() | ||
} | ||
|
||
cl := cluster.New(graph, id, cluster.Label(comp.Impl)) | ||
|
||
el := node.New(cl, id, | ||
node.Label("LB", false), | ||
node.Rounded(comp.Rounded), | ||
node.FontColor(comp.FontColor), | ||
node.FillColor(comp.FillColor, "#1a5276ff"), | ||
node.Shape("Mdiamond"), | ||
) | ||
el.Attr("height", "0.3") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package draft | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/emicklei/dot" | ||
"github.com/lucasepe/draft/pkg/cluster" | ||
"github.com/lucasepe/draft/pkg/node" | ||
) | ||
|
||
type cdn struct { | ||
seq int16 | ||
} | ||
|
||
func (rcv *cdn) nextID() string { | ||
rcv.seq++ | ||
return fmt.Sprintf("cn%d", rcv.seq) | ||
} | ||
|
||
func (rcv *cdn) sketch(graph *dot.Graph, comp Component) { | ||
id := comp.ID | ||
if strings.TrimSpace(comp.ID) == "" { | ||
id = rcv.nextID() | ||
} | ||
|
||
cl := cluster.New(graph, id, cluster.Label(comp.Impl)) | ||
|
||
el := node.New(cl, id, | ||
node.Label("CDN", false), | ||
node.FontColor(comp.FontColor), | ||
node.FillColor(comp.FillColor, "#47df9aff"), | ||
node.Shape("Mcircle"), | ||
) | ||
el.Attr("height", "0.5") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package draft | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/emicklei/dot" | ||
"github.com/lucasepe/draft/pkg/cluster" | ||
"github.com/lucasepe/draft/pkg/node" | ||
) | ||
|
||
type dns struct { | ||
seq int16 | ||
} | ||
|
||
func (rcv *dns) nextID() string { | ||
rcv.seq++ | ||
return fmt.Sprintf("dn%d", rcv.seq) | ||
} | ||
|
||
func (rcv *dns) sketch(graph *dot.Graph, comp Component) { | ||
id := comp.ID | ||
if strings.TrimSpace(comp.ID) == "" { | ||
id = rcv.nextID() | ||
} | ||
|
||
cl := cluster.New(graph, id, cluster.Label(comp.Impl)) | ||
|
||
el := node.New(cl, id, | ||
node.Label("DNS", false), | ||
node.FontColor(comp.FontColor), | ||
node.FillColor(comp.FillColor, "#854eadff"), | ||
node.Shape("Msquare"), | ||
) | ||
el.Attr("height", "0.3") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
components: | ||
- | ||
kind: balancer |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
components: | ||
- | ||
kind: cdn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
backgroundColor: '#ffffff' | ||
components: | ||
- | ||
kind: client | ||
label: Client | ||
- | ||
kind: service | ||
label: |- | ||
<table border="0"> | ||
<tr><td><b>Service</b></td><td><b>IP Addr.</b></td></tr> | ||
<tr><td>μService</td><td>10.234.30.1</td></tr> | ||
<tr><td>μService</td><td>10.234.30.2</td></tr> | ||
<tr><td>μService</td><td>10.234.30.3</td></tr> | ||
<tr><td>...</td><td>...</td></tr> | ||
</table> | ||
html: true | ||
impl: Service Registry | ||
- | ||
kind: service | ||
label: μService | ||
impl: "Instance #1 @10.234.30.1" | ||
- | ||
kind: service | ||
label: μService | ||
impl: "Instance #2 @10.234.30.2" | ||
- | ||
kind: service | ||
label: μService | ||
impl: "Instance #3 @10.234.30.3" | ||
connections: | ||
- | ||
origin: | ||
componentId: cl1 | ||
targets: | ||
- | ||
componentId: ms1 | ||
label: Query(μService) | ||
- | ||
origin: | ||
componentId: ms1 | ||
targets: | ||
- | ||
componentId: ms2 | ||
dir: back | ||
color: '#63625b' | ||
dashed: true | ||
- | ||
componentId: ms3 | ||
dir: back | ||
color: '#63625b' | ||
dashed: true | ||
- | ||
componentId: ms4 | ||
dir: back | ||
color: '#63625b' | ||
dashed: true | ||
- | ||
origin: | ||
componentId: cl1 | ||
targets: | ||
- | ||
componentId: ms3 | ||
label: Load Balance Request | ||
- |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.