├── .idea
├── .gitignore
├── design-pattern.iml
├── modules.xml
└── vcs.xml
├── README.md
├── abstract_factory
├── abstract_factory.go
├── ikea
│ ├── factory.go
│ └── product
│ │ ├── hemlingby.go
│ │ ├── leifarne.go
│ │ └── vittsjo.go
└── informa
│ ├── factory.go
│ └── product
│ └── beanbag.go
├── adapter
└── adapter.go
├── bridge
├── chrome.go
├── color.go
├── os.go
└── shape.go
├── builder
└── house.go
├── chainofresponsibility
├── lower.go
├── space.go
└── string.go
├── command
├── chef.go
├── command.go
├── main.go
└── waiter.go
├── composite
├── ceo.go
├── employee.go
├── kroco.go
└── vpeng.go
├── decorator
└── door
│ ├── door.go
│ ├── electronic_key.go
│ └── magical_key.go
├── facade
├── facade.go
└── gofood
│ └── gofood.go
├── factory
└── factory.go
├── flyweight
└── video.go
├── go.mod
├── iterator
├── array.go
└── runner.go
├── main.go
├── mediator
├── moderator.go
├── participant.go
└── runner.go
├── memento
├── controller.go
├── executor.go
├── memento.go
└── text_editor.go
├── prototype
├── factory
│ └── factory.go
└── prototype.go
├── singleton
└── db.go
├── state
├── correct
│ ├── lightswitch.go
│ ├── lightswitch_test.go
│ ├── off.go
│ ├── off_test.go
│ ├── on.go
│ └── on_test.go
└── incorrect_sample
│ └── light_swith.go
├── strategy
├── context.go
├── flight.go
├── road.go
└── strategy.go
├── template
├── email.go
├── otp.go
├── phone.go
├── runner.go
└── sms.go
├── test-ledger
├── .tmp4cBGtq
│ ├── genesis.bin
│ └── rocksdb
│ │ ├── 000004.log
│ │ ├── CURRENT
│ │ ├── IDENTITY
│ │ ├── LOCK
│ │ ├── LOG
│ │ ├── MANIFEST-000003
│ │ ├── OPTIONS-000074
│ │ └── OPTIONS-000076
├── accounts
│ ├── 0.0
│ ├── 0.1
│ ├── 0.2
│ ├── 0.3
│ ├── 0.39
│ ├── 0.4
│ ├── 0.5
│ ├── 1.6
│ ├── 10.15
│ ├── 10.57
│ ├── 11.16
│ ├── 11.59
│ ├── 12.17
│ ├── 12.61
│ ├── 13.18
│ ├── 13.63
│ ├── 14.19
│ ├── 14.65
│ ├── 15.20
│ ├── 16.21
│ ├── 17.22
│ ├── 18.23
│ ├── 19.24
│ ├── 2.41
│ ├── 2.7
│ ├── 20.25
│ ├── 21.26
│ ├── 22.27
│ ├── 23.28
│ ├── 24.29
│ ├── 25.30
│ ├── 26.31
│ ├── 27.32
│ ├── 28.33
│ ├── 29.34
│ ├── 3.43
│ ├── 3.8
│ ├── 30.35
│ ├── 31.36
│ ├── 32.37
│ ├── 33.38
│ ├── 34.40
│ ├── 35.42
│ ├── 36.44
│ ├── 37.46
│ ├── 38.48
│ ├── 39.50
│ ├── 4.45
│ ├── 4.9
│ ├── 40.52
│ ├── 41.54
│ ├── 42.56
│ ├── 43.58
│ ├── 44.60
│ ├── 45.62
│ ├── 46.64
│ ├── 47.66
│ ├── 5.10
│ ├── 5.47
│ ├── 6.11
│ ├── 6.49
│ ├── 7.12
│ ├── 7.51
│ ├── 8.13
│ ├── 8.53
│ ├── 9.14
│ └── 9.55
├── faucet-keypair.json
├── genesis.bin
├── genesis.tar.bz2
├── ledger.lock
├── rocksdb
│ ├── 000077.sst
│ ├── 000078.sst
│ ├── 000079.sst
│ ├── 000080.sst
│ ├── 000081.sst
│ ├── 000082.sst
│ ├── 000083.sst
│ ├── 000085.log
│ ├── CURRENT
│ ├── IDENTITY
│ ├── LOCK
│ ├── LOG
│ ├── LOG.old.1638084177080379
│ ├── MANIFEST-000084
│ ├── OPTIONS-000117
│ └── OPTIONS-000119
├── tower-4u5QPTpzJkeRMzzGpyuGP51zReWUcYg6bFTNBK5bwCR4.bin
├── validator-1638084176600.log
├── validator-keypair.json
├── validator.log
└── vote-account-keypair.json
└── visitor
├── dentist
└── dentist.go
├── interface.go
└── patient
└── patient.go
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/.idea/design-pattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Design Pattern
2 | ===
3 |
4 | Design Pattern Playlist [Youtube](https://www.youtube.com/playlist?list=PLJDedZCB3DvD_o1eToWrJVIlVFpQAGlNl)
--------------------------------------------------------------------------------
/abstract_factory/abstract_factory.go:
--------------------------------------------------------------------------------
1 | package abstract_factory
2 |
3 | type Pricey interface {
4 | Price() float64
5 | }
6 |
7 | type Chair interface {
8 | Pricey
9 | IsIoTEnabled() bool
10 | IsSoft() bool
11 | }
12 |
13 | type Dimension struct {
14 | Length, Width, Height int
15 | }
16 |
17 | type CoffeeTable interface {
18 | Pricey
19 | Size() Dimension
20 | IsFoldable() bool
21 | }
22 |
23 | type SofaStyle string
24 |
25 | const (
26 | EuropeanStyle SofaStyle = "european"
27 | AmericanStyle SofaStyle = "american"
28 | )
29 |
30 | type Sofa interface {
31 | Pricey
32 | Style() SofaStyle
33 | }
34 |
35 | type FurnitureFactory interface {
36 | CreateChair() Chair
37 | CreateCoffeeTable() CoffeeTable
38 | CreateSofa() Sofa
39 | }
40 |
--------------------------------------------------------------------------------
/abstract_factory/ikea/factory.go:
--------------------------------------------------------------------------------
1 | package ikea
2 |
3 | import (
4 | "github.com/imrenagi/design-pattern/abstract_factory"
5 | "github.com/imrenagi/design-pattern/abstract_factory/ikea/product"
6 | )
7 |
8 | type Ikea struct {
9 | }
10 |
11 | func (i *Ikea) CreateChair() abstract_factory.Chair {
12 | return &product.Leifarne{}
13 | }
14 |
15 | func (i *Ikea) CreateCoffeeTable() abstract_factory.CoffeeTable {
16 | return &product.VITTSJÖ{}
17 | }
18 |
19 | func (i *Ikea) CreateSofa() abstract_factory.Sofa {
20 | return &product.HEMLINGBY{}
21 | }
22 |
--------------------------------------------------------------------------------
/abstract_factory/ikea/product/hemlingby.go:
--------------------------------------------------------------------------------
1 | package product
2 |
3 | import "github.com/imrenagi/design-pattern/abstract_factory"
4 |
5 | type HEMLINGBY struct {
6 | }
7 |
8 | func (h HEMLINGBY) Price() float64 {
9 | return 1795000
10 | }
11 |
12 | func (h HEMLINGBY) Style() abstract_factory.SofaStyle {
13 | return abstract_factory.EuropeanStyle
14 | }
15 |
--------------------------------------------------------------------------------
/abstract_factory/ikea/product/leifarne.go:
--------------------------------------------------------------------------------
1 | package product
2 |
3 | type Leifarne struct {}
4 |
5 | func (l *Leifarne) Price() float64 {
6 | return 1095000
7 | }
8 |
9 | func (l *Leifarne) IsIoTEnabled() bool {
10 | return false
11 | }
12 |
13 | func (l *Leifarne) IsSoft() bool {
14 | return false
15 | }
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/abstract_factory/ikea/product/vittsjo.go:
--------------------------------------------------------------------------------
1 | package product
2 |
3 | import "github.com/imrenagi/design-pattern/abstract_factory"
4 |
5 | type VITTSJÖ struct {
6 | }
7 |
8 | func (v VITTSJÖ) Price() float64 {
9 | return 899000
10 | }
11 |
12 | func (v VITTSJÖ) Size() abstract_factory.Dimension {
13 | return abstract_factory.Dimension{
14 | Length: 80,
15 | Width: 78,
16 | Height: 40,
17 | }
18 | }
19 |
20 | func (v VITTSJÖ) IsFoldable() bool {
21 | return false
22 | }
23 |
--------------------------------------------------------------------------------
/abstract_factory/informa/factory.go:
--------------------------------------------------------------------------------
1 | package informa
2 |
3 | import (
4 | "github.com/imrenagi/design-pattern/abstract_factory"
5 | "github.com/imrenagi/design-pattern/abstract_factory/informa/product"
6 | )
7 |
8 | type Informa struct {
9 | }
10 |
11 | func (i *Informa) CreateChair() abstract_factory.Chair {
12 | return &product.BeanBag{
13 | // price: product.Price,
14 | // SoftnessLevel: product.SoftnessLevel,
15 | }
16 | }
17 |
18 | func (i *Informa) CreateCoffeeTable() abstract_factory.CoffeeTable {
19 | return nil
20 | }
21 |
22 | func (i *Informa) CreateSofa() abstract_factory.Sofa {
23 | return nil
24 | }
25 |
--------------------------------------------------------------------------------
/abstract_factory/informa/product/beanbag.go:
--------------------------------------------------------------------------------
1 | package product
2 |
3 | type BeanBag struct {
4 | price float64
5 | SoftnessLevel int
6 | }
7 |
8 | func (b BeanBag) Price() float64 {
9 | return b.price
10 | }
11 |
12 | func (b BeanBag) IsIoTEnabled() bool {
13 | return false
14 | }
15 |
16 | func (b BeanBag) IsSoft() bool {
17 | return b.SoftnessLevel > 10
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/adapter/adapter.go:
--------------------------------------------------------------------------------
1 | package adapter
2 |
3 | import "fmt"
4 |
5 | type AudioPlayer interface {
6 | Play(m Mp3)
7 | }
8 |
9 | type Mp3 struct {
10 | Data []byte
11 | }
12 |
13 | func (m Mp3) PlayAudio() {
14 | fmt.Println("playing mp3 with data" + string(m.Data))
15 | }
16 |
17 | type Kaset struct {
18 | PitaMusik string
19 | }
20 |
21 | // Walkman is the legacy
22 | type Walkman struct {}
23 |
24 | func (w Walkman) Play(c Kaset) {
25 | fmt.Println(c.PitaMusik)
26 | }
27 |
28 | type Mp3ToKasetAdapter struct {
29 | Adaptee Walkman
30 | }
31 |
32 | func (a Mp3ToKasetAdapter) Play(m Mp3) {
33 | k := Kaset{}
34 | k.PitaMusik = string(m.Data)
35 | a.Adaptee.Play(k)
36 | }
37 |
38 | func Execute() {
39 | mp3 := Mp3{Data: []byte(`this is taylor swift song`)}
40 | walkman := Walkman{}
41 |
42 | ad := Mp3ToKasetAdapter{Adaptee: walkman}
43 | ad.Play(mp3)
44 | }
--------------------------------------------------------------------------------
/bridge/chrome.go:
--------------------------------------------------------------------------------
1 | package bridge
2 |
3 | type Chrome interface {
4 | OpenURL()
5 | }
6 |
7 | type Beta struct {
8 | OperatingSystem OS
9 | }
10 |
11 | func (b Beta) OpenURL() {
12 | b.OperatingSystem.OpenLink()
13 | }
14 |
15 | func NewChromeBetaForUbuntu() Chrome {
16 | return &Beta{
17 | OperatingSystem: Ubuntu{},
18 | }
19 | }
20 |
21 | func NewChromeBetaForWindows() Chrome {
22 | return &Beta{
23 | OperatingSystem: Windows{},
24 | }
25 | }
26 |
27 |
28 |
--------------------------------------------------------------------------------
/bridge/color.go:
--------------------------------------------------------------------------------
1 | package bridge
2 |
3 | type Color interface {
4 | Hex() string
5 | }
6 |
7 | type Red struct {}
8 |
9 | func (r Red) Hex() string {
10 | return "#E22E5D"
11 | }
12 |
13 | type Green struct {}
14 |
15 | func (g Green) Hex() string {
16 | return "#57D658"
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/bridge/os.go:
--------------------------------------------------------------------------------
1 | package bridge
2 |
3 | import "fmt"
4 |
5 | type OS interface {
6 | OpenLink()
7 | }
8 |
9 | type Windows struct {
10 |
11 | }
12 |
13 | func (w Windows) OpenLink() {
14 | fmt.Println("opening a link in windows")
15 | }
16 |
17 | type Ubuntu struct {
18 |
19 | }
20 |
21 | func (u Ubuntu) OpenLink() {
22 | fmt.Println("opening a link in ubuntu")
23 | }
--------------------------------------------------------------------------------
/bridge/shape.go:
--------------------------------------------------------------------------------
1 | package bridge
2 |
3 | import "fmt"
4 |
5 | type Shape interface {
6 | Draw()
7 | Area() float64
8 | }
9 |
10 | type Circle struct {
11 | Color Color
12 | Radius int
13 | }
14 |
15 | func (c Circle) Draw() {
16 | if c.Color != nil {
17 | fmt.Println("drawing a circle with color " + c.Color.Hex())
18 | } else {
19 | fmt.Println("drawing a circle")
20 | }
21 | }
22 |
23 | func (c Circle) Area() float64 {
24 | return 3.14 * float64(c.Radius) * float64(c.Radius)
25 | }
26 |
27 | func (c Circle) Clone() Circle {
28 | return Circle{
29 | Color: c.Color,
30 | Radius: c.Radius,
31 | }
32 | }
33 |
34 | type Square struct {
35 | Color Color
36 | Length int
37 | }
38 |
39 | func (s Square) Draw() {
40 | fmt.Println("drawing a square" + s.Color.Hex())
41 | }
42 |
43 | func (s Square) Area() float64 {
44 | area := s.Length * s.Length
45 | return float64(area)
46 | }
47 |
48 | func Execute() {
49 | c := Circle{
50 | Radius: 10,
51 | }
52 | c.Draw() // drawing a circle
53 |
54 | greenCircle2 := c.Clone()
55 | greenCircle2.Color = Green{}
56 | greenCircle2.Draw() // drawing a circle with color #57D658
57 |
58 | redCircle := Circle{
59 | Radius: 12,
60 | Color: Red{},
61 | }
62 | redCircle.Draw() // drawing a circle with color #E22E5D
63 |
64 | greenSquare := Square{
65 | Length: 5,
66 | Color: Green{},
67 | }
68 | greenSquare.Draw() // drawing a square #57D658
69 | }
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/builder/house.go:
--------------------------------------------------------------------------------
1 | package builder
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | )
7 |
8 | type House struct {
9 | numOfWindows int
10 | numOfDoors int
11 | hasGarage bool
12 | hasSwimmingPool bool
13 | }
14 |
15 | func NewHouse(numOfWindows int, numOfDoors int, hasGarage bool, hasSwimmingPool bool) *House {
16 |
17 | if numOfWindows > 5 {
18 | numOfWindows = 5
19 | }
20 |
21 | if numOfDoors > 2 {
22 | numOfWindows = 2
23 | }
24 |
25 | if hasGarage && numOfWindows == 5 {
26 | hasGarage = true
27 | } else {
28 | hasGarage = false
29 | }
30 |
31 | return &House{
32 | numOfWindows: numOfWindows,
33 | numOfDoors: numOfDoors,
34 | hasGarage: hasGarage,
35 | hasSwimmingPool: hasSwimmingPool,
36 | }
37 | }
38 |
39 | type HouseBuilder struct {
40 | house House
41 | }
42 |
43 | func (b *HouseBuilder) SetWindow(window int) *HouseBuilder {
44 | if b.house.numOfWindows < window {
45 | b.house.numOfWindows = window
46 | }
47 | return b
48 | }
49 |
50 | func (b *HouseBuilder) BuildDoor() *HouseBuilder {
51 | b.house.numOfDoors++
52 | return b
53 | }
54 |
55 | func (b *HouseBuilder) SetGarage(t string) *HouseBuilder {
56 | if t == "large" {
57 | b.house.hasGarage = true
58 | }
59 | return b
60 | }
61 |
62 | func (b *HouseBuilder) GetResult() (*House, error) {
63 | if !b.house.hasGarage {
64 | return nil, fmt.Errorf("a house must have a garage")
65 | }
66 | return &b.house, nil
67 | }
68 |
69 | func Execute() {
70 | hb := HouseBuilder{}
71 | house, err := hb.
72 | BuildDoor().
73 | SetGarage("large").GetResult()
74 | if err != nil {
75 | log.Fatal(err)
76 | }
77 |
78 | fmt.Println(house)
79 | }
80 |
--------------------------------------------------------------------------------
/chainofresponsibility/lower.go:
--------------------------------------------------------------------------------
1 | package chainofresponsibility
2 |
3 | import "strings"
4 |
5 | type LowerCaseHandler struct {
6 | upperCase StringHandler
7 | next StringHandler
8 | }
9 |
10 | func (l LowerCaseHandler) Process(s string) string {
11 | if len(s) < 5 {
12 | s = l.next.Process(s)
13 | } else {
14 | s = strings.ToLower(s)
15 | if l.upperCase != nil {
16 | s = l.upperCase.Process(s)
17 | }
18 | }
19 | return s
20 | }
21 |
22 | func (l *LowerCaseHandler) SetNext(h StringHandler) {
23 | l.upperCase = h
24 | }
25 |
--------------------------------------------------------------------------------
/chainofresponsibility/space.go:
--------------------------------------------------------------------------------
1 | package chainofresponsibility
2 |
3 | import "strings"
4 |
5 | type SpaceRemoval struct {
6 | next StringHandler
7 | }
8 |
9 | func (s *SpaceRemoval) SetNext(h StringHandler) {
10 | s.next = h
11 | }
12 |
13 | func (s SpaceRemoval) Process(st string) string {
14 | st = strings.Replace(st, " ", "", -1)
15 | if s.next != nil {
16 | st = s.next.Process(st)
17 | }
18 | return st
19 | }
20 |
--------------------------------------------------------------------------------
/chainofresponsibility/string.go:
--------------------------------------------------------------------------------
1 | package chainofresponsibility
2 |
3 | import "fmt"
4 |
5 | type StringHandler interface {
6 | SetNext(h StringHandler)
7 | Process(s string) string
8 | }
9 |
10 |
11 | func Execute() {
12 |
13 | // lc -> sr
14 |
15 | sr := SpaceRemoval{}
16 | lc := LowerCaseHandler{}
17 | lc.SetNext(&sr)
18 |
19 |
20 | st := lc.Process("THE titanic")
21 | // st2 := sr.Process("Hello world")
22 |
23 | // fmt.Println(st2)
24 | fmt.Println(st)
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/command/chef.go:
--------------------------------------------------------------------------------
1 | package command
2 |
3 | import "fmt"
4 |
5 | type FriedRiceParams struct {
6 | Spiciness int
7 | Saltiness int
8 | ExtraEgg bool
9 | }
10 |
11 | type Chef interface {
12 | CookFriedRice(params FriedRiceParams)
13 | PrepareSatePadang(params SatePadangParams)
14 | }
15 |
16 | type LordAdi struct{}
17 |
18 | func (la *LordAdi) CookFriedRice(params FriedRiceParams) {
19 | fmt.Println("lord adi cooks fried rice %v", params)
20 | }
21 |
22 | func (la *LordAdi) PrepareSatePadang(params SatePadangParams) {
23 | fmt.Println("lord adi cooks sate oadang %v", params)
24 | }
25 |
26 | type SatePadangParams struct {
27 | KetupatCount int
28 | SateCount int
29 | Tounge bool
30 | }
31 |
--------------------------------------------------------------------------------
/command/command.go:
--------------------------------------------------------------------------------
1 | package command
2 |
3 | type Interface interface {
4 | Execute()
5 | }
6 |
7 | type FriedRiceCommand struct {
8 | Chef Chef //receiver
9 | Param FriedRiceParams
10 | }
11 |
12 | func (frc FriedRiceCommand) Execute() {
13 | frc.Chef.CookFriedRice(frc.Param)
14 | }
15 |
16 | type SatePadangCommand struct {
17 | Chef Chef
18 | Params SatePadangParams
19 | }
20 |
21 | func (spc SatePadangCommand) Execute() {
22 | spc.Chef.PrepareSatePadang(spc.Params)
23 | }
--------------------------------------------------------------------------------
/command/main.go:
--------------------------------------------------------------------------------
1 | package command
2 |
3 | func Execute() {
4 |
5 | lordAdi := &LordAdi{}
6 |
7 | w1 := Waiter{}
8 |
9 | fc := &FriedRiceCommand{
10 | Chef: lordAdi,
11 | Param: FriedRiceParams{
12 | Spiciness: 1,
13 | Saltiness: 0,
14 | ExtraEgg: true,
15 | },
16 | }
17 |
18 | w1.AddOrder(fc)
19 |
20 | sc := &SatePadangCommand{
21 | Chef: lordAdi,
22 | Params: SatePadangParams{
23 | KetupatCount: 1,
24 | SateCount: 20,
25 | Tounge: false,
26 | },
27 | }
28 |
29 | w1.AddOrder(sc)
30 |
31 | w1.Finalize()
32 | }
--------------------------------------------------------------------------------
/command/waiter.go:
--------------------------------------------------------------------------------
1 | package command
2 |
3 | type Waiter struct {
4 | Commands []Interface
5 | }
6 |
7 | func (w *Waiter) AddOrder(c Interface) {
8 | w.Commands = append(w.Commands, c)
9 | }
10 |
11 | func (w Waiter) Finalize() {
12 | for _, c := range w.Commands {
13 | c.Execute()
14 | }
15 | }
--------------------------------------------------------------------------------
/composite/ceo.go:
--------------------------------------------------------------------------------
1 | package composite
2 |
3 | type CEO struct {
4 | Subordinates []Employee
5 | }
6 |
7 | func (c CEO) GetSalary() int {
8 | return 10
9 | }
10 |
11 | func (c CEO) TotalDivisionSalary() int {
12 | var sum int
13 | for _, s := range c.Subordinates {
14 | sum = sum + s.TotalDivisionSalary()
15 | }
16 | return c.GetSalary() + sum
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/composite/employee.go:
--------------------------------------------------------------------------------
1 | package composite
2 |
3 | type Employee interface {
4 | GetSalary() int
5 | TotalDivisionSalary() int
6 | }
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/composite/kroco.go:
--------------------------------------------------------------------------------
1 | package composite
2 |
3 | type Kroco struct {}
4 |
5 | func (k Kroco) GetSalary() int {
6 | return 6
7 | }
8 |
9 | func (k Kroco) TotalDivisionSalary() int {
10 | return 0
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/composite/vpeng.go:
--------------------------------------------------------------------------------
1 | package composite
2 |
3 | type VPEng struct {
4 | Subordinates []Employee
5 | }
6 |
7 | func (v VPEng) GetSalary() int {
8 | return 8
9 | }
10 |
11 | func (v VPEng) TotalDivisionSalary() int {
12 | var sum int
13 | for _, s := range v.Subordinates {
14 | sum = sum + s.GetSalary()
15 | }
16 | return v.GetSalary() + sum
17 | }
18 |
--------------------------------------------------------------------------------
/decorator/door/door.go:
--------------------------------------------------------------------------------
1 | package door
2 |
3 | import "fmt"
4 |
5 | type Opener interface {
6 | Open()
7 | TriggerAlarm()
8 | }
9 |
10 | type Door struct {
11 | }
12 |
13 | func (d Door) Open() {
14 | fmt.Println("door is open")
15 | fmt.Println("ada suara ketika buka pintu")
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/decorator/door/electronic_key.go:
--------------------------------------------------------------------------------
1 | package door
2 |
3 | import "fmt"
4 |
5 | func NewElectronicKeyDoor(opener Opener) Opener {
6 | return &ElectronicKey{
7 | opener: opener,
8 | }
9 | }
10 |
11 | type ElectronicKey struct {
12 | opener Opener
13 | }
14 |
15 | func (e ElectronicKey) Open() {
16 | fmt.Println("this is electronic key")
17 | ok := e.ConnectToWifi()
18 | if ok {
19 | e.opener.Open()
20 | }
21 | }
22 |
23 | func (e ElectronicKey) ConnectToWifi() bool {
24 | fmt.Println("connecting to wifi")
25 | // e.opener.Open()
26 | return false
27 | }
28 |
--------------------------------------------------------------------------------
/decorator/door/magical_key.go:
--------------------------------------------------------------------------------
1 | package door
2 |
3 | import (
4 | "fmt"
5 | "math/rand"
6 | )
7 |
8 | func NewMagicalDoor(o Opener) Opener {
9 | return &MagicalKey{opener: o}
10 | }
11 |
12 | type MagicalKey struct {
13 | opener Opener
14 | }
15 |
16 | func (e MagicalKey) Open() {
17 | fmt.Println("magical key is dangerous")
18 | if e.CanWeUseMagic() {
19 | fmt.Println("magic is working")
20 | e.opener.Open()
21 | } else {
22 | fmt.Println("cant use magic. use your hand")
23 | e.opener.TriggerAlarm()
24 | }
25 | }
26 |
27 | func (e MagicalKey) CanWeUseMagic() bool {
28 | return rand.Int() > 0
29 | }
30 |
--------------------------------------------------------------------------------
/facade/facade.go:
--------------------------------------------------------------------------------
1 | package facade
2 |
3 | import "github.com/imrenagi/design-pattern/facade/gofood"
4 |
5 | type Ticket struct {
6 | User string
7 | Type string
8 | Message string
9 | }
10 |
11 | type Response struct {
12 | Status string
13 | }
14 |
15 | func HandleTicket(t Ticket) Response {
16 | switch t.Type {
17 | case "gofood":
18 | response := gofood.CheckMessage(t.Message)
19 | return Response{Status: response}
20 | case "goride":
21 | case "gosend":
22 | }
23 |
24 | return Response{
25 | Status: "customer service is busy",
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/facade/gofood/gofood.go:
--------------------------------------------------------------------------------
1 | package gofood
2 |
3 | func CheckMessage(message string) string {
4 | return"gofood system is processing complain"
5 | }
6 |
--------------------------------------------------------------------------------
/factory/factory.go:
--------------------------------------------------------------------------------
1 | package factory
2 |
3 | import (
4 | "fmt"
5 | "time"
6 |
7 | "github.com/imrenagi/design-pattern/singleton"
8 | )
9 |
10 | func Execute() {
11 | db := singleton.GetDBInstanceWithLock()
12 | db.GetUser("nagi")
13 | }
14 |
15 | type Content interface {
16 | Play()
17 | }
18 |
19 | type CloudContent struct {}
20 |
21 | func (c *CloudContent) Play() {
22 | fmt.Println("this is cloud content about kubernetes")
23 | }
24 |
25 | type CodingContent struct {}
26 |
27 | func (c *CodingContent) Play() {
28 | fmt.Println("this is coding content for teaching design pattern")
29 | }
30 |
31 | type GrebekRumah struct {}
32 |
33 | func (g *GrebekRumah) Play() {
34 | fmt.Println("ini adalah konten yang sangat diminati para remaja")
35 | }
36 |
37 | type ContentType string
38 |
39 | const (
40 | Hiburan ContentType = "hiburan"
41 | Edukasi ContentType = "edukasi"
42 | )
43 |
44 | type ContentCreator interface {
45 | Produce(time time.Time) Content
46 | Type() ContentType
47 | }
48 |
49 | type Imre struct {
50 | }
51 |
52 | func (i *Imre) Produce(time time.Time) Content {
53 | if time.Weekday().String() == "Tuesday" {
54 | return &CloudContent{}
55 | } else if time.Weekday().String() == "Thursday" {
56 | return &CodingContent{}
57 | } else {
58 | return nil
59 | }
60 | }
61 |
62 | func (i Imre) Type() ContentType {
63 | return Edukasi
64 | }
65 |
66 | type Atta struct {
67 | }
68 |
69 | func (a *Atta) Produce(time time.Time) Content {
70 | return &GrebekRumah{}
71 | }
72 |
73 | func (a *Atta) Type() ContentType {
74 | return Hiburan
75 | }
76 |
--------------------------------------------------------------------------------
/flyweight/video.go:
--------------------------------------------------------------------------------
1 | package flyweight
2 |
3 | import (
4 | "fmt"
5 | "time"
6 | )
7 |
8 | type ThirdPartyYoutubeLib interface {
9 | ListVideo() []string
10 | }
11 |
12 | type ThirdPartyYoutubeImpl struct {}
13 |
14 | func (t ThirdPartyYoutubeImpl) ListVideo() []string {
15 | <- time.After(200 * time.Millisecond)
16 | return []string{
17 | "https://youtube.com/watch/1",
18 | "https://youtube.com/watch/2",
19 | }
20 | }
21 |
22 | type CacheYoutube struct {
23 | service ThirdPartyYoutubeLib
24 | cache []string
25 | }
26 |
27 | func (c *CacheYoutube) run() {
28 | for {
29 | select {
30 | case <- time.After(5 * time.Second):
31 | c.cache = []string{}
32 | }
33 | }
34 | }
35 |
36 | func (c *CacheYoutube) ListVideo() []string {
37 | if len(c.cache) == 0 {
38 | c.cache = c.service.ListVideo()
39 | fmt.Println("call real api to get list of videos")
40 | }
41 | fmt.Println("return list of videos")
42 | return c.cache
43 | }
44 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/imrenagi/design-pattern
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/iterator/array.go:
--------------------------------------------------------------------------------
1 | package iterator
2 |
3 | import "fmt"
4 |
5 | type Iterator interface {
6 | Next() int
7 | HasNext() bool
8 | }
9 |
10 | type IterableCollection interface {
11 | CreateIterator(direction bool) Iterator
12 | }
13 |
14 | type Array []int
15 |
16 | func (a Array) CreateIterator(direction bool) Iterator {
17 | if direction {
18 | return &ForwardIterator{Arr: a}
19 | } else {
20 | return &BackwardIterator{Arr: a, CurrIdx: len(a)-1}
21 | }
22 | }
23 |
24 | type ForwardIterator struct {
25 | CurrIdx int
26 | Arr Array
27 | }
28 |
29 | func (f *ForwardIterator) Next() int {
30 | val := f.Arr[f.CurrIdx]
31 | f.CurrIdx++
32 | return val
33 | }
34 |
35 | func (f ForwardIterator) HasNext() bool {
36 | fmt.Println(f.Arr)
37 | length := len(f.Arr)
38 | return f.CurrIdx <= length-1
39 | }
40 |
41 | type BackwardIterator struct {
42 | CurrIdx int
43 | Arr Array
44 | }
45 |
46 | func (f *BackwardIterator) Next() int {
47 | val := f.Arr[f.CurrIdx]
48 | f.CurrIdx--
49 | return val
50 | }
51 |
52 | func (f BackwardIterator) HasNext() bool {
53 | return f.CurrIdx >= 0
54 | }
55 |
--------------------------------------------------------------------------------
/iterator/runner.go:
--------------------------------------------------------------------------------
1 | package iterator
2 |
3 | import "fmt"
4 |
5 | func Execute() {
6 | arr := Array{1, 2, 3, 5}
7 | it := arr.CreateIterator(true)
8 |
9 | val := it.Next()
10 | fmt.Println(val)
11 |
12 | arr = append(arr, 6)
13 |
14 | for it.HasNext() {
15 | fmt.Println(it.Next())
16 | }
17 | fmt.Println("------")
18 |
19 |
20 | //
21 | // backwardIt := arr.CreateIterator(false)
22 | // for backwardIt.HasNext() {
23 | // fmt.Println(backwardIt.Next())
24 | // }
25 | }
26 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "github.com/imrenagi/design-pattern/iterator"
5 | )
6 |
7 | func main() {
8 | iterator.Execute()
9 | }
10 |
--------------------------------------------------------------------------------
/mediator/moderator.go:
--------------------------------------------------------------------------------
1 | package mediator
2 |
3 | import (
4 | "fmt"
5 | )
6 |
7 | type Moderator interface {
8 | Notify(sender Participant) error
9 | }
10 |
11 | type Teacher struct {
12 | P1, P2 Participant
13 | }
14 |
15 | func (t *Teacher) Notify(sender Participant) error {
16 | var answer string
17 | if t.P1.GetName() == sender.GetName() {
18 | answer = t.P1.Answer()
19 |
20 | } else {
21 | answer = t.P2.Answer()
22 | }
23 | fmt.Println(answer)
24 | return nil
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/mediator/participant.go:
--------------------------------------------------------------------------------
1 | package mediator
2 |
3 | import "fmt"
4 |
5 | type Participant interface {
6 | GetName() string
7 | Answer() string
8 | }
9 |
10 | type Student struct {
11 | Moderator Moderator
12 | Name string
13 | }
14 |
15 | func (h Student) GetName() string {
16 | return h.Name
17 | }
18 |
19 | func (h Student) PressButton() {
20 | fmt.Println(h.Name, "pressed button")
21 | h.Moderator.Notify(h)
22 | }
23 |
24 | func (h Student) Answer() string {
25 | return fmt.Sprintf("%s menjawab pertanyaan", h.Name)
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/mediator/runner.go:
--------------------------------------------------------------------------------
1 | package mediator
2 |
3 | func Execute() {
4 |
5 | t := Teacher{}
6 |
7 | s1 := Student{
8 | Moderator: &t,
9 | Name: "Andi",
10 | }
11 |
12 | s2 := Student{
13 | Moderator: &t,
14 | Name: "Tini",
15 | }
16 |
17 | t.P1 = s1
18 | t.P2 = s2
19 |
20 | s1.PressButton()
21 | s2.PressButton()
22 | }
23 |
--------------------------------------------------------------------------------
/memento/controller.go:
--------------------------------------------------------------------------------
1 | package memento
2 |
3 | import "fmt"
4 |
5 | type Controller struct {
6 | Editor *Editor
7 | Histories []Memento
8 |
9 | // ptr is pointer to the current snapshot being used
10 | ptr int
11 | }
12 |
13 | func (c *Controller) CmdSave() {
14 | m := c.Editor.Save()
15 | c.Histories = append(c.Histories, m)
16 |
17 | l := len(c.Histories)
18 | c.ptr = l-1
19 |
20 | fmt.Println("current pointer ", c.ptr)
21 | }
22 |
23 | func (c *Controller) CmdUndo() {
24 | c.ptr -= 1
25 | m := c.Histories[c.ptr]
26 | c.Editor.Restore(m)
27 | fmt.Println("undo current pointer ", c.ptr)
28 | }
29 |
30 | func (c *Controller) CmdRedo() {
31 | l := len(c.Histories)
32 | if (c.ptr + 1) >= l {
33 | return
34 | }
35 | c.ptr++
36 | m := c.Histories[c.ptr]
37 | c.Editor.Restore(m)
38 |
39 | fmt.Println("redo current pointer ", c.ptr)
40 | }
41 |
--------------------------------------------------------------------------------
/memento/executor.go:
--------------------------------------------------------------------------------
1 | package memento
2 |
3 | import "fmt"
4 |
5 | func Execute() {
6 |
7 | editor := &Editor{}
8 | editor.Text = "text pertama"
9 |
10 | controller := Controller{
11 | Editor: editor,
12 | }
13 |
14 | controller.CmdSave()
15 |
16 | fmt.Println(editor.Text)
17 |
18 | editor.Text = "text pertama udah diupdate"
19 |
20 | controller.CmdSave()
21 |
22 | fmt.Println(editor.Text)
23 |
24 | controller.CmdUndo()
25 |
26 | fmt.Println(editor.Text)
27 |
28 | controller.CmdRedo()
29 |
30 | fmt.Println(editor.Text)
31 |
32 | controller.CmdRedo()
33 | controller.CmdRedo()
34 |
35 | fmt.Println(editor.Text)
36 |
37 | //
38 | // controller.CmdSave()
39 | //
40 | // fmt.Println(editor.Text)
41 | //
42 | // controller.CmdUndo()
43 | //
44 | // fmt.Println(editor.Text)
45 | //
46 | // controller.CmdUndo()
47 | //
48 | // fmt.Println(editor.Text)
49 |
50 |
51 |
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/memento/memento.go:
--------------------------------------------------------------------------------
1 | package memento
2 |
3 | type Memento interface {
4 | GetText() string
5 | }
6 |
7 | type Snapshot struct {
8 | Text string
9 | }
10 |
11 | func (s Snapshot) GetText() string {
12 | return s.Text
13 | }
14 |
--------------------------------------------------------------------------------
/memento/text_editor.go:
--------------------------------------------------------------------------------
1 | package memento
2 |
3 | type Editor struct {
4 | Text string
5 | }
6 |
7 | func (e *Editor) Save() Memento {
8 | return Snapshot{Text: e.Text}
9 | }
10 |
11 | func (e *Editor) Restore(m Memento) {
12 | e.Text = m.GetText()
13 | }
--------------------------------------------------------------------------------
/prototype/factory/factory.go:
--------------------------------------------------------------------------------
1 | package factory
2 |
3 | import "github.com/imrenagi/design-pattern/prototype"
4 |
5 | type Factory struct {}
6 |
7 | func (f Factory) CopyRobot(r *prototype.Robot) *prototype.Robot {
8 | return r.Clone()
9 | }
10 |
--------------------------------------------------------------------------------
/prototype/prototype.go:
--------------------------------------------------------------------------------
1 | package prototype
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/imrenagi/design-pattern/singleton"
7 | )
8 |
9 | type Prototype interface {
10 | Clone() Prototype
11 | }
12 |
13 | type Robot struct {
14 | ID string
15 | Name string
16 | processor string // private properties
17 | }
18 |
19 | func NewRobot(p Prototype) Prototype {
20 | return p.Clone()
21 | }
22 |
23 | func (r Robot) Clone() Prototype {
24 | return &Robot{
25 | Name: r.Name,
26 | ID: r.ID,
27 | processor: r.processor,
28 | }
29 | }
30 |
31 | func Execute() {
32 | r := Robot{
33 | Name: "imre",
34 | ID: "1",
35 | }
36 |
37 | r2 := r.Clone()
38 | robot2, ok := r2.(*Robot)
39 | if ok {
40 | robot2.Name = "John"
41 | }
42 |
43 | fmt.Println(r.Name) // imre
44 | fmt.Println(robot2.Name) //John
45 |
46 | db := singleton.GetDBInstanceWithOnce()
47 | db.GetUser("imrenagi")
48 | }
--------------------------------------------------------------------------------
/singleton/db.go:
--------------------------------------------------------------------------------
1 | package singleton
2 |
3 | import "sync"
4 |
5 | var (
6 | instance *db
7 | )
8 |
9 | type db struct {}
10 |
11 | func (d db) GetUser(ID string) string {
12 | return ""
13 | }
14 |
15 | var lock = &sync.Mutex{}
16 |
17 | var once sync.Once
18 |
19 | var onceBody = func() {
20 | instance = &db{}
21 | }
22 |
23 | // GetDBInstance is using singleton pattern
24 | func GetDBInstanceWithOnce() *db {
25 | once.Do(onceBody)
26 | return instance
27 | }
28 |
29 | func GetDBInstanceWithLock() *db {
30 | if instance == nil {
31 | lock.Lock()
32 | defer lock.Unlock()
33 | onceBody()
34 | }
35 | return instance
36 | }
37 |
--------------------------------------------------------------------------------
/state/correct/lightswitch.go:
--------------------------------------------------------------------------------
1 | package correct
2 |
3 | import "fmt"
4 |
5 | type State interface {
6 | Press()
7 | CanTurnOnLight() bool
8 | }
9 |
10 | func NewLightSwitch() *LightSwitch {
11 | ls := &LightSwitch{}
12 | ls.ChangeState(&Off{ls})
13 | return ls
14 | }
15 |
16 | type LightSwitch struct {
17 | State State
18 | }
19 |
20 | func (ls LightSwitch) Press() {
21 | ls.State.Press()
22 | fmt.Println("udah selesai")
23 | }
24 |
25 | func (ls LightSwitch) CanTurnOnLight() bool {
26 | return ls.State.CanTurnOnLight()
27 | }
28 |
29 | func (ls *LightSwitch) ChangeState(state State) {
30 | ls.State = state
31 | }
32 |
33 | func (ls LightSwitch) IsElectricityOn() bool {
34 | return true
35 | }
36 |
--------------------------------------------------------------------------------
/state/correct/lightswitch_test.go:
--------------------------------------------------------------------------------
1 | package correct
2 |
--------------------------------------------------------------------------------
/state/correct/off.go:
--------------------------------------------------------------------------------
1 | package correct
2 |
3 |
4 | type Off struct {
5 | LightSwitch *LightSwitch
6 | }
7 |
8 | func (o Off) Press() {
9 | if !o.LightSwitch.IsElectricityOn() {
10 | return
11 | }
12 | o.LightSwitch.ChangeState(
13 | &On{LightSwitch: o.LightSwitch})
14 | }
15 |
16 | func (o Off) CanTurnOnLight() bool {
17 | return false
18 | }
19 |
--------------------------------------------------------------------------------
/state/correct/off_test.go:
--------------------------------------------------------------------------------
1 | package correct_test
2 |
--------------------------------------------------------------------------------
/state/correct/on.go:
--------------------------------------------------------------------------------
1 | package correct
2 |
3 | type On struct {
4 | LightSwitch *LightSwitch
5 | }
6 |
7 | func (o On) Press() {
8 | o.LightSwitch.ChangeState(
9 | &Off{LightSwitch: o.LightSwitch})
10 | }
11 |
12 | func (o On) CanTurnOnLight() bool {
13 | return true
14 | }
--------------------------------------------------------------------------------
/state/correct/on_test.go:
--------------------------------------------------------------------------------
1 | package correct_test
2 |
--------------------------------------------------------------------------------
/state/incorrect_sample/light_swith.go:
--------------------------------------------------------------------------------
1 | package incorrect_sample
2 |
3 | type LightState string
4 |
5 | const (
6 | On LightState = "on"
7 | Off LightState = "off"
8 | Dim LightState = "dim"
9 | )
10 |
11 | type LightSwitch struct {
12 | State LightState
13 | }
14 |
15 | func (ls LightSwitch) Press() {
16 | if ls.State == Off {
17 | ls.State = On
18 | } else if ls.State == On {
19 | ls.State = Off
20 | } else {
21 | ls.State = Dim
22 | }
23 | }
24 |
25 | func (ls LightSwitch) CanTurnOnLight() bool {
26 | return ls.State == On
27 | }
28 |
--------------------------------------------------------------------------------
/strategy/context.go:
--------------------------------------------------------------------------------
1 | package strategy
2 |
3 | import (
4 | "fmt"
5 | "time"
6 | )
7 |
8 | func NewContext(s Interface) *Context{
9 | return &Context{strategy: s}
10 | }
11 |
12 | type Context struct {
13 | strategy Interface
14 | }
15 |
16 | func (c *Context) SetStrategy(s Interface) {
17 | // validasi
18 | c.strategy = s
19 | }
20 |
21 | func (c Context) CalculateETA(startAt time.Time, td TripDetail) time.Time {
22 | return c.strategy.CalculateETA(startAt, td)
23 | }
24 |
25 | func Execute() {
26 |
27 | road := Road{}
28 | flight := Flight{wp: &WPImpl{}}
29 |
30 | now := time.Now()
31 | fmt.Println(now)
32 |
33 | ctx := NewContext(road)
34 | t1 := ctx.CalculateETA(now, TripDetail{
35 | Origin: Location{
36 | CityName: "Bogor",
37 | },
38 | Destination: Location{
39 | CityName: "Cengkareng",
40 | },
41 | })
42 |
43 | fmt.Println(t1)
44 |
45 | ctx.SetStrategy(flight)
46 | t2 := ctx.CalculateETA(t1, TripDetail{
47 | Origin: Location{
48 | CityName: "Cengkareng",
49 | },
50 | Destination: Location{
51 | CityName: "Surabaya",
52 | },
53 | })
54 |
55 | fmt.Println(t2)
56 |
57 | }
58 |
59 |
60 |
--------------------------------------------------------------------------------
/strategy/flight.go:
--------------------------------------------------------------------------------
1 | package strategy
2 |
3 | import "time"
4 |
5 | type WeatherPredictor interface {
6 | Predict(cityName string) bool
7 | }
8 |
9 | type WPImpl struct {
10 | }
11 |
12 | func (wp WPImpl) Predict(cityName string) bool {
13 | return false
14 | }
15 |
16 | type Flight struct {
17 | wp WeatherPredictor
18 | }
19 |
20 | func (f Flight) CalculateCost(distance float64) float64 {
21 | return (10000000 + distance * 500000)/200
22 | }
23 |
24 | const (
25 | defaultAirSpeed = 500 // kmh
26 | )
27 |
28 |
29 | func (f Flight) CalculateETA(startAt time.Time, trip TripDetail) time.Time {
30 | t := trip.Distance() / defaultSpeed
31 | var y int = int(t)
32 | duration := time.Duration(y) * time.Hour
33 |
34 | eta := startAt.Add(duration)
35 | ok := f.wp.Predict(trip.Origin.CityName)
36 | if !ok {
37 | eta = eta.Add(1 * time.Hour)
38 | }
39 | return eta
40 | }
41 |
--------------------------------------------------------------------------------
/strategy/road.go:
--------------------------------------------------------------------------------
1 | package strategy
2 |
3 | import "time"
4 |
5 | type Road struct {
6 | }
7 |
8 | func (r Road) CalculateCost(distance float64) float64 {
9 | return 100000 + distance * 5000
10 | }
11 |
12 | const (
13 | defaultSpeed = 80 // kmh
14 | )
15 |
16 | func (r Road) CalculateETA(startAt time.Time, trip TripDetail) time.Time {
17 | t := trip.Distance() / defaultSpeed
18 | var y int = int(t)
19 | duration := time.Duration(y) * time.Hour
20 | return startAt.Add(duration)
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/strategy/strategy.go:
--------------------------------------------------------------------------------
1 | package strategy
2 |
3 | import "time"
4 |
5 | type Interface interface {
6 | CalculateCost(distance float64) float64
7 | CalculateETA(startAt time.Time, td TripDetail) time.Time
8 | }
9 |
10 | type Location struct {
11 | CityName string
12 | Lat, Lng float64
13 | }
14 |
15 | type TripDetail struct {
16 | Origin, Destination Location
17 | }
18 |
19 | func (t TripDetail) Distance() float64 {
20 | // calculate distance from origin to destination
21 | return 10
22 | }
23 |
--------------------------------------------------------------------------------
/template/email.go:
--------------------------------------------------------------------------------
1 | package template
2 |
3 | import "fmt"
4 |
5 | type email struct {
6 | otp
7 | }
8 |
9 | func (s *email) getMessage(otp string) string {
10 | return "EMAIL OTP for login is " + otp
11 | }
12 |
13 | func (s *email) sendNotification(message string) error {
14 | fmt.Printf("EMAIL: sending email: %s\n", message)
15 | return nil
16 | }
17 |
18 | func (s *email) publishMetric() {
19 | fmt.Printf("EMAIL: publishing metrics\n")
20 | }
21 |
--------------------------------------------------------------------------------
/template/otp.go:
--------------------------------------------------------------------------------
1 | package template
2 |
3 | import "fmt"
4 |
5 | type iOtp interface {
6 | genRandomOTP(int) string
7 | saveOTPCache(string)
8 | getMessage(string) string
9 | sendNotification(string) error
10 | publishMetric()
11 | }
12 |
13 | type otp struct {
14 | iOtp iOtp
15 | }
16 |
17 | func (o *otp) genRandomOTP(len int) string {
18 | randomOTP := "1234"
19 | fmt.Printf("OTP: generating random otp %s\n", randomOTP)
20 | return randomOTP
21 | }
22 |
23 | func (o *otp) saveOTPCache(otp string) {
24 | fmt.Printf("OTP: saving otp: %s to cache\n", otp)
25 |
26 | type Car struct {
27 | Name string
28 | Color string
29 | }
30 |
31 | cars := []Car{}
32 | for _, it := range cars {
33 | it.Name
34 | }
35 |
36 | }
37 |
38 | func (o *otp) genAndSendOTP(otpLength int) error {
39 | otp := o.iOtp.genRandomOTP(otpLength)
40 | o.iOtp.saveOTPCache(otp)
41 | message := o.iOtp.getMessage(otp)
42 | err := o.iOtp.sendNotification(message)
43 | if err != nil {
44 | return err
45 | }
46 | o.iOtp.publishMetric()
47 | return nil
48 | }
49 |
--------------------------------------------------------------------------------
/template/phone.go:
--------------------------------------------------------------------------------
1 | package template
2 |
3 | import "fmt"
4 |
5 | type phone struct {
6 | otp
7 | }
8 |
9 | func (p *phone) genRandomOTP(length int) string {
10 | randomOTP := "12345678910"
11 | fmt.Println("PHONE: genRandomOTP ", randomOTP)
12 | return randomOTP
13 | }
14 |
15 | func (p *phone) getMessage(otp string) string {
16 | fmt.Println("PHONE: getMessage OTP for login is ", otp)
17 | return "This is bot, your otp code for login is " + otp
18 | }
19 |
20 | func (p *phone) sendNotification(msg string) error {
21 | fmt.Println("PHONE: creating a phone call with message ", msg)
22 | return nil
23 | }
24 |
25 | func (p *phone) publishMetric() {
26 | fmt.Println("PHONE: publishMetric")
27 | }
28 |
--------------------------------------------------------------------------------
/template/runner.go:
--------------------------------------------------------------------------------
1 | package template
2 |
3 | import "fmt"
4 |
5 | func Execute() {
6 | smsOTP := &sms{
7 | }
8 | o := otp{
9 | iOtp: smsOTP,
10 | }
11 | o.genAndSendOTP(4)
12 |
13 | fmt.Println("")
14 | emailOTP := &email{}
15 | o = otp{
16 | iOtp: emailOTP,
17 | }
18 | o.genAndSendOTP(4)
19 |
20 | fmt.Println("")
21 | phoneOTP := &phone{}
22 | o = otp{
23 | iOtp: phoneOTP,
24 | }
25 | o.genAndSendOTP(4)
26 | }
27 |
--------------------------------------------------------------------------------
/template/sms.go:
--------------------------------------------------------------------------------
1 | package template
2 |
3 | import "fmt"
4 |
5 | type sms struct {
6 | otp
7 | }
8 |
9 | func (s *sms) getMessage(otp string) string {
10 | return "SMS OTP for login is " + otp
11 | }
12 |
13 | func (s *sms) sendNotification(message string) error {
14 | fmt.Printf("SMS: sending sms: %s\n", message)
15 | return nil
16 | }
17 |
18 | func (s *sms) publishMetric() {
19 | fmt.Printf("SMS: publishing metrics\n")
20 | }
21 |
--------------------------------------------------------------------------------
/test-ledger/.tmp4cBGtq/genesis.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/.tmp4cBGtq/genesis.bin
--------------------------------------------------------------------------------
/test-ledger/.tmp4cBGtq/rocksdb/000004.log:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/.tmp4cBGtq/rocksdb/000004.log
--------------------------------------------------------------------------------
/test-ledger/.tmp4cBGtq/rocksdb/CURRENT:
--------------------------------------------------------------------------------
1 | MANIFEST-000003
2 |
--------------------------------------------------------------------------------
/test-ledger/.tmp4cBGtq/rocksdb/IDENTITY:
--------------------------------------------------------------------------------
1 | 16bba4e1336bdc90-82572e0dd0b20d58
--------------------------------------------------------------------------------
/test-ledger/.tmp4cBGtq/rocksdb/LOCK:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/.tmp4cBGtq/rocksdb/LOCK
--------------------------------------------------------------------------------
/test-ledger/.tmp4cBGtq/rocksdb/MANIFEST-000003:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/.tmp4cBGtq/rocksdb/MANIFEST-000003
--------------------------------------------------------------------------------
/test-ledger/accounts/0.0:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/0.0
--------------------------------------------------------------------------------
/test-ledger/accounts/0.1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/0.1
--------------------------------------------------------------------------------
/test-ledger/accounts/0.2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/0.2
--------------------------------------------------------------------------------
/test-ledger/accounts/0.3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/0.3
--------------------------------------------------------------------------------
/test-ledger/accounts/0.39:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/0.39
--------------------------------------------------------------------------------
/test-ledger/accounts/0.4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/0.4
--------------------------------------------------------------------------------
/test-ledger/accounts/0.5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/0.5
--------------------------------------------------------------------------------
/test-ledger/accounts/1.6:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/1.6
--------------------------------------------------------------------------------
/test-ledger/accounts/10.15:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/10.15
--------------------------------------------------------------------------------
/test-ledger/accounts/10.57:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/10.57
--------------------------------------------------------------------------------
/test-ledger/accounts/11.16:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/11.16
--------------------------------------------------------------------------------
/test-ledger/accounts/11.59:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/11.59
--------------------------------------------------------------------------------
/test-ledger/accounts/12.17:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/12.17
--------------------------------------------------------------------------------
/test-ledger/accounts/12.61:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/12.61
--------------------------------------------------------------------------------
/test-ledger/accounts/13.18:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/13.18
--------------------------------------------------------------------------------
/test-ledger/accounts/13.63:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/13.63
--------------------------------------------------------------------------------
/test-ledger/accounts/14.19:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/14.19
--------------------------------------------------------------------------------
/test-ledger/accounts/14.65:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/14.65
--------------------------------------------------------------------------------
/test-ledger/accounts/15.20:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/15.20
--------------------------------------------------------------------------------
/test-ledger/accounts/16.21:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/16.21
--------------------------------------------------------------------------------
/test-ledger/accounts/17.22:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/17.22
--------------------------------------------------------------------------------
/test-ledger/accounts/18.23:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/18.23
--------------------------------------------------------------------------------
/test-ledger/accounts/19.24:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/19.24
--------------------------------------------------------------------------------
/test-ledger/accounts/2.41:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/2.41
--------------------------------------------------------------------------------
/test-ledger/accounts/2.7:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/2.7
--------------------------------------------------------------------------------
/test-ledger/accounts/20.25:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/20.25
--------------------------------------------------------------------------------
/test-ledger/accounts/21.26:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/21.26
--------------------------------------------------------------------------------
/test-ledger/accounts/22.27:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/22.27
--------------------------------------------------------------------------------
/test-ledger/accounts/23.28:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/23.28
--------------------------------------------------------------------------------
/test-ledger/accounts/24.29:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/24.29
--------------------------------------------------------------------------------
/test-ledger/accounts/25.30:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/25.30
--------------------------------------------------------------------------------
/test-ledger/accounts/26.31:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/26.31
--------------------------------------------------------------------------------
/test-ledger/accounts/27.32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/27.32
--------------------------------------------------------------------------------
/test-ledger/accounts/28.33:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/28.33
--------------------------------------------------------------------------------
/test-ledger/accounts/29.34:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/29.34
--------------------------------------------------------------------------------
/test-ledger/accounts/3.43:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/3.43
--------------------------------------------------------------------------------
/test-ledger/accounts/3.8:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/3.8
--------------------------------------------------------------------------------
/test-ledger/accounts/30.35:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/30.35
--------------------------------------------------------------------------------
/test-ledger/accounts/31.36:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/31.36
--------------------------------------------------------------------------------
/test-ledger/accounts/32.37:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/32.37
--------------------------------------------------------------------------------
/test-ledger/accounts/33.38:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/33.38
--------------------------------------------------------------------------------
/test-ledger/accounts/34.40:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/34.40
--------------------------------------------------------------------------------
/test-ledger/accounts/35.42:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/35.42
--------------------------------------------------------------------------------
/test-ledger/accounts/36.44:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/36.44
--------------------------------------------------------------------------------
/test-ledger/accounts/37.46:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/37.46
--------------------------------------------------------------------------------
/test-ledger/accounts/38.48:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/38.48
--------------------------------------------------------------------------------
/test-ledger/accounts/39.50:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/39.50
--------------------------------------------------------------------------------
/test-ledger/accounts/4.45:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/4.45
--------------------------------------------------------------------------------
/test-ledger/accounts/4.9:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/4.9
--------------------------------------------------------------------------------
/test-ledger/accounts/40.52:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/40.52
--------------------------------------------------------------------------------
/test-ledger/accounts/41.54:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/41.54
--------------------------------------------------------------------------------
/test-ledger/accounts/42.56:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/42.56
--------------------------------------------------------------------------------
/test-ledger/accounts/43.58:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/43.58
--------------------------------------------------------------------------------
/test-ledger/accounts/44.60:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/44.60
--------------------------------------------------------------------------------
/test-ledger/accounts/45.62:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/45.62
--------------------------------------------------------------------------------
/test-ledger/accounts/46.64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/46.64
--------------------------------------------------------------------------------
/test-ledger/accounts/47.66:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/47.66
--------------------------------------------------------------------------------
/test-ledger/accounts/5.10:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/5.10
--------------------------------------------------------------------------------
/test-ledger/accounts/5.47:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/5.47
--------------------------------------------------------------------------------
/test-ledger/accounts/6.11:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/6.11
--------------------------------------------------------------------------------
/test-ledger/accounts/6.49:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/6.49
--------------------------------------------------------------------------------
/test-ledger/accounts/7.12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/7.12
--------------------------------------------------------------------------------
/test-ledger/accounts/7.51:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/7.51
--------------------------------------------------------------------------------
/test-ledger/accounts/8.13:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/8.13
--------------------------------------------------------------------------------
/test-ledger/accounts/8.53:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/8.53
--------------------------------------------------------------------------------
/test-ledger/accounts/9.14:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/9.14
--------------------------------------------------------------------------------
/test-ledger/accounts/9.55:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/accounts/9.55
--------------------------------------------------------------------------------
/test-ledger/faucet-keypair.json:
--------------------------------------------------------------------------------
1 | [249,59,57,185,47,185,97,28,199,22,222,223,37,1,181,233,200,171,134,12,145,120,37,81,159,33,132,175,231,15,102,162,73,34,240,52,58,40,107,226,153,112,223,159,165,240,38,120,228,195,66,187,143,45,2,72,77,183,97,5,182,98,197,188]
--------------------------------------------------------------------------------
/test-ledger/genesis.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/genesis.bin
--------------------------------------------------------------------------------
/test-ledger/genesis.tar.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/genesis.tar.bz2
--------------------------------------------------------------------------------
/test-ledger/ledger.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/ledger.lock
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000077.sst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000077.sst
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000078.sst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000078.sst
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000079.sst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000079.sst
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000080.sst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000080.sst
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000081.sst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000081.sst
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000082.sst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000082.sst
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000083.sst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000083.sst
--------------------------------------------------------------------------------
/test-ledger/rocksdb/000085.log:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/000085.log
--------------------------------------------------------------------------------
/test-ledger/rocksdb/CURRENT:
--------------------------------------------------------------------------------
1 | MANIFEST-000084
2 |
--------------------------------------------------------------------------------
/test-ledger/rocksdb/IDENTITY:
--------------------------------------------------------------------------------
1 | 16bba4e1336bdc90-82572e0dd0b20d58
--------------------------------------------------------------------------------
/test-ledger/rocksdb/LOCK:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/LOCK
--------------------------------------------------------------------------------
/test-ledger/rocksdb/MANIFEST-000084:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/rocksdb/MANIFEST-000084
--------------------------------------------------------------------------------
/test-ledger/rocksdb/OPTIONS-000117:
--------------------------------------------------------------------------------
1 | # This is a RocksDB option file.
2 | #
3 | # For detailed file format spec, please refer to the example file
4 | # in examples/rocksdb_option_file_example.ini
5 | #
6 |
7 | [Version]
8 | rocksdb_version=6.17.3
9 | options_file_version=1.1
10 |
11 | [DBOptions]
12 | max_background_flushes=-1
13 | compaction_readahead_size=0
14 | strict_bytes_per_sync=false
15 | wal_bytes_per_sync=0
16 | max_open_files=-1
17 | stats_history_buffer_size=1048576
18 | max_total_wal_size=4294967296
19 | stats_persist_period_sec=600
20 | stats_dump_period_sec=600
21 | avoid_flush_during_shutdown=false
22 | max_subcompactions=1
23 | bytes_per_sync=0
24 | delayed_write_rate=16777216
25 | max_background_compactions=-1
26 | max_background_jobs=16
27 | delete_obsolete_files_period_micros=21600000000
28 | writable_file_max_buffer_size=1048576
29 | base_background_compactions=-1
30 | allow_data_in_errors=false
31 | max_bgerror_resume_count=2147483647
32 | best_efforts_recovery=false
33 | write_dbid_to_manifest=false
34 | atomic_flush=false
35 | manual_wal_flush=false
36 | two_write_queues=false
37 | preserve_deletes=false
38 | avoid_flush_during_recovery=false
39 | dump_malloc_stats=false
40 | info_log_level=INFO_LEVEL
41 | access_hint_on_compaction_start=NORMAL
42 | use_adaptive_mutex=false
43 | max_write_batch_group_size_bytes=1048576
44 | wal_recovery_mode=kPointInTimeRecovery
45 | bgerror_resume_retry_interval=1000000
46 | paranoid_checks=true
47 | WAL_size_limit_MB=0
48 | allow_concurrent_memtable_write=true
49 | allow_ingest_behind=false
50 | fail_if_options_file_error=false
51 | persist_stats_to_disk=false
52 | WAL_ttl_seconds=0
53 | wal_dir=test-ledger/rocksdb
54 | keep_log_file_num=1000
55 | table_cache_numshardbits=6
56 | max_file_opening_threads=16
57 | use_fsync=false
58 | unordered_write=false
59 | random_access_max_buffer_size=1048576
60 | db_write_buffer_size=0
61 | allow_2pc=false
62 | skip_checking_sst_file_sizes_on_db_open=false
63 | write_thread_slow_yield_usec=3
64 | skip_stats_update_on_db_open=false
65 | track_and_verify_wals_in_manifest=false
66 | error_if_exists=false
67 | manifest_preallocation_size=4194304
68 | is_fd_close_on_exec=true
69 | max_log_file_size=0
70 | advise_random_on_open=true
71 | use_direct_reads=false
72 | write_thread_max_yield_usec=100
73 | enable_write_thread_adaptive_yield=true
74 | create_missing_column_families=true
75 | create_if_missing=true
76 | log_file_time_to_roll=0
77 | use_direct_io_for_flush_and_compaction=false
78 | avoid_unnecessary_blocking_io=false
79 | allow_fallocate=true
80 | max_manifest_file_size=1073741824
81 | enable_thread_tracking=false
82 | recycle_log_file_num=0
83 | db_host_id=__hostname__
84 | allow_mmap_reads=false
85 | log_readahead_size=0
86 | enable_pipelined_write=false
87 | new_table_reader_for_compaction_inputs=false
88 | allow_mmap_writes=false
89 |
90 |
91 | [CFOptions "default"]
92 | bottommost_compression=kDisableCompressionOption
93 | sample_for_compression=0
94 | blob_garbage_collection_age_cutoff=0.250000
95 | arena_block_size=8388608
96 | enable_blob_garbage_collection=false
97 | level0_stop_writes_trigger=36
98 | min_blob_size=0
99 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
100 | target_file_size_base=67108864
101 | max_bytes_for_level_base=268435456
102 | memtable_whole_key_filtering=false
103 | soft_pending_compaction_bytes_limit=68719476736
104 | blob_compression_type=kNoCompression
105 | max_write_buffer_number=2
106 | ttl=2592000
107 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
108 | check_flush_compaction_key_order=true
109 | max_successive_merges=0
110 | inplace_update_num_locks=10000
111 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
112 | target_file_size_multiplier=1
113 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
114 | enable_blob_files=false
115 | level0_slowdown_writes_trigger=20
116 | compression=kNoCompression
117 | level0_file_num_compaction_trigger=4
118 | blob_file_size=268435456
119 | prefix_extractor=nullptr
120 | max_bytes_for_level_multiplier=10.000000
121 | write_buffer_size=67108864
122 | disable_auto_compactions=false
123 | max_compaction_bytes=1677721600
124 | memtable_huge_page_size=0
125 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
126 | hard_pending_compaction_bytes_limit=274877906944
127 | periodic_compaction_seconds=0
128 | paranoid_file_checks=false
129 | memtable_prefix_bloom_size_ratio=0.000000
130 | max_sequential_skip_in_iterations=8
131 | report_bg_io_stats=false
132 | compaction_pri=kMinOverlappingRatio
133 | compaction_style=kCompactionStyleLevel
134 | memtable_factory=SkipListFactory
135 | comparator=leveldb.BytewiseComparator
136 | bloom_locality=0
137 | compaction_filter_factory=nullptr
138 | min_write_buffer_number_to_merge=1
139 | max_write_buffer_number_to_maintain=0
140 | compaction_filter=nullptr
141 | merge_operator=nullptr
142 | num_levels=7
143 | optimize_filters_for_hits=false
144 | force_consistency_checks=true
145 | table_factory=BlockBasedTable
146 | max_write_buffer_size_to_maintain=0
147 | memtable_insert_with_hint_prefix_extractor=nullptr
148 | level_compaction_dynamic_level_bytes=false
149 | inplace_update_support=false
150 |
151 | [TableOptions/BlockBasedTable "default"]
152 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
153 | read_amp_bytes_per_bit=0
154 | verify_compression=false
155 | format_version=4
156 | optimize_filters_for_memory=false
157 | partition_filters=false
158 | enable_index_compression=true
159 | checksum=kCRC32c
160 | index_block_restart_interval=1
161 | pin_top_level_index_and_filter=true
162 | block_align=false
163 | block_size=4096
164 | index_type=kBinarySearch
165 | filter_policy=nullptr
166 | metadata_block_size=4096
167 | no_block_cache=false
168 | whole_key_filtering=true
169 | index_shortening=kShortenSeparators
170 | block_size_deviation=10
171 | data_block_index_type=kDataBlockBinarySearch
172 | data_block_hash_table_util_ratio=0.750000
173 | cache_index_and_filter_blocks=false
174 | block_restart_interval=16
175 | pin_l0_filter_and_index_blocks_in_cache=false
176 | hash_index_allow_collision=true
177 | cache_index_and_filter_blocks_with_high_priority=true
178 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
179 |
180 |
181 | [CFOptions "meta"]
182 | bottommost_compression=kDisableCompressionOption
183 | sample_for_compression=0
184 | blob_garbage_collection_age_cutoff=0.250000
185 | arena_block_size=33554432
186 | enable_blob_garbage_collection=false
187 | level0_stop_writes_trigger=36
188 | min_blob_size=0
189 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
190 | target_file_size_base=107374182
191 | max_bytes_for_level_base=1073741824
192 | memtable_whole_key_filtering=false
193 | soft_pending_compaction_bytes_limit=68719476736
194 | blob_compression_type=kNoCompression
195 | max_write_buffer_number=8
196 | ttl=2592000
197 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
198 | check_flush_compaction_key_order=true
199 | max_successive_merges=0
200 | inplace_update_num_locks=10000
201 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
202 | target_file_size_multiplier=1
203 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
204 | enable_blob_files=false
205 | level0_slowdown_writes_trigger=20
206 | compression=kNoCompression
207 | level0_file_num_compaction_trigger=4
208 | blob_file_size=268435456
209 | prefix_extractor=nullptr
210 | max_bytes_for_level_multiplier=10.000000
211 | write_buffer_size=268435456
212 | disable_auto_compactions=false
213 | max_compaction_bytes=2684354550
214 | memtable_huge_page_size=0
215 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
216 | hard_pending_compaction_bytes_limit=274877906944
217 | periodic_compaction_seconds=86400
218 | paranoid_file_checks=false
219 | memtable_prefix_bloom_size_ratio=0.000000
220 | max_sequential_skip_in_iterations=8
221 | report_bg_io_stats=false
222 | compaction_pri=kMinOverlappingRatio
223 | compaction_style=kCompactionStyleLevel
224 | memtable_factory=SkipListFactory
225 | comparator=leveldb.BytewiseComparator
226 | bloom_locality=0
227 | compaction_filter_factory=purged_slot_filter_factory(meta)
228 | min_write_buffer_number_to_merge=1
229 | max_write_buffer_number_to_maintain=0
230 | compaction_filter=nullptr
231 | merge_operator=nullptr
232 | num_levels=7
233 | optimize_filters_for_hits=false
234 | force_consistency_checks=true
235 | table_factory=BlockBasedTable
236 | max_write_buffer_size_to_maintain=0
237 | memtable_insert_with_hint_prefix_extractor=nullptr
238 | level_compaction_dynamic_level_bytes=false
239 | inplace_update_support=false
240 |
241 | [TableOptions/BlockBasedTable "meta"]
242 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
243 | read_amp_bytes_per_bit=0
244 | verify_compression=false
245 | format_version=4
246 | optimize_filters_for_memory=false
247 | partition_filters=false
248 | enable_index_compression=true
249 | checksum=kCRC32c
250 | index_block_restart_interval=1
251 | pin_top_level_index_and_filter=true
252 | block_align=false
253 | block_size=4096
254 | index_type=kBinarySearch
255 | filter_policy=nullptr
256 | metadata_block_size=4096
257 | no_block_cache=false
258 | whole_key_filtering=true
259 | index_shortening=kShortenSeparators
260 | block_size_deviation=10
261 | data_block_index_type=kDataBlockBinarySearch
262 | data_block_hash_table_util_ratio=0.750000
263 | cache_index_and_filter_blocks=false
264 | block_restart_interval=16
265 | pin_l0_filter_and_index_blocks_in_cache=false
266 | hash_index_allow_collision=true
267 | cache_index_and_filter_blocks_with_high_priority=true
268 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
269 |
270 |
271 | [CFOptions "dead_slots"]
272 | bottommost_compression=kDisableCompressionOption
273 | sample_for_compression=0
274 | blob_garbage_collection_age_cutoff=0.250000
275 | arena_block_size=33554432
276 | enable_blob_garbage_collection=false
277 | level0_stop_writes_trigger=36
278 | min_blob_size=0
279 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
280 | target_file_size_base=107374182
281 | max_bytes_for_level_base=1073741824
282 | memtable_whole_key_filtering=false
283 | soft_pending_compaction_bytes_limit=68719476736
284 | blob_compression_type=kNoCompression
285 | max_write_buffer_number=8
286 | ttl=2592000
287 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
288 | check_flush_compaction_key_order=true
289 | max_successive_merges=0
290 | inplace_update_num_locks=10000
291 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
292 | target_file_size_multiplier=1
293 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
294 | enable_blob_files=false
295 | level0_slowdown_writes_trigger=20
296 | compression=kNoCompression
297 | level0_file_num_compaction_trigger=4
298 | blob_file_size=268435456
299 | prefix_extractor=nullptr
300 | max_bytes_for_level_multiplier=10.000000
301 | write_buffer_size=268435456
302 | disable_auto_compactions=false
303 | max_compaction_bytes=2684354550
304 | memtable_huge_page_size=0
305 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
306 | hard_pending_compaction_bytes_limit=274877906944
307 | periodic_compaction_seconds=86400
308 | paranoid_file_checks=false
309 | memtable_prefix_bloom_size_ratio=0.000000
310 | max_sequential_skip_in_iterations=8
311 | report_bg_io_stats=false
312 | compaction_pri=kMinOverlappingRatio
313 | compaction_style=kCompactionStyleLevel
314 | memtable_factory=SkipListFactory
315 | comparator=leveldb.BytewiseComparator
316 | bloom_locality=0
317 | compaction_filter_factory=purged_slot_filter_factory(dead_slots)
318 | min_write_buffer_number_to_merge=1
319 | max_write_buffer_number_to_maintain=0
320 | compaction_filter=nullptr
321 | merge_operator=nullptr
322 | num_levels=7
323 | optimize_filters_for_hits=false
324 | force_consistency_checks=true
325 | table_factory=BlockBasedTable
326 | max_write_buffer_size_to_maintain=0
327 | memtable_insert_with_hint_prefix_extractor=nullptr
328 | level_compaction_dynamic_level_bytes=false
329 | inplace_update_support=false
330 |
331 | [TableOptions/BlockBasedTable "dead_slots"]
332 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
333 | read_amp_bytes_per_bit=0
334 | verify_compression=false
335 | format_version=4
336 | optimize_filters_for_memory=false
337 | partition_filters=false
338 | enable_index_compression=true
339 | checksum=kCRC32c
340 | index_block_restart_interval=1
341 | pin_top_level_index_and_filter=true
342 | block_align=false
343 | block_size=4096
344 | index_type=kBinarySearch
345 | filter_policy=nullptr
346 | metadata_block_size=4096
347 | no_block_cache=false
348 | whole_key_filtering=true
349 | index_shortening=kShortenSeparators
350 | block_size_deviation=10
351 | data_block_index_type=kDataBlockBinarySearch
352 | data_block_hash_table_util_ratio=0.750000
353 | cache_index_and_filter_blocks=false
354 | block_restart_interval=16
355 | pin_l0_filter_and_index_blocks_in_cache=false
356 | hash_index_allow_collision=true
357 | cache_index_and_filter_blocks_with_high_priority=true
358 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
359 |
360 |
361 | [CFOptions "duplicate_slots"]
362 | bottommost_compression=kDisableCompressionOption
363 | sample_for_compression=0
364 | blob_garbage_collection_age_cutoff=0.250000
365 | arena_block_size=33554432
366 | enable_blob_garbage_collection=false
367 | level0_stop_writes_trigger=36
368 | min_blob_size=0
369 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
370 | target_file_size_base=107374182
371 | max_bytes_for_level_base=1073741824
372 | memtable_whole_key_filtering=false
373 | soft_pending_compaction_bytes_limit=68719476736
374 | blob_compression_type=kNoCompression
375 | max_write_buffer_number=8
376 | ttl=2592000
377 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
378 | check_flush_compaction_key_order=true
379 | max_successive_merges=0
380 | inplace_update_num_locks=10000
381 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
382 | target_file_size_multiplier=1
383 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
384 | enable_blob_files=false
385 | level0_slowdown_writes_trigger=20
386 | compression=kNoCompression
387 | level0_file_num_compaction_trigger=4
388 | blob_file_size=268435456
389 | prefix_extractor=nullptr
390 | max_bytes_for_level_multiplier=10.000000
391 | write_buffer_size=268435456
392 | disable_auto_compactions=false
393 | max_compaction_bytes=2684354550
394 | memtable_huge_page_size=0
395 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
396 | hard_pending_compaction_bytes_limit=274877906944
397 | periodic_compaction_seconds=86400
398 | paranoid_file_checks=false
399 | memtable_prefix_bloom_size_ratio=0.000000
400 | max_sequential_skip_in_iterations=8
401 | report_bg_io_stats=false
402 | compaction_pri=kMinOverlappingRatio
403 | compaction_style=kCompactionStyleLevel
404 | memtable_factory=SkipListFactory
405 | comparator=leveldb.BytewiseComparator
406 | bloom_locality=0
407 | compaction_filter_factory=purged_slot_filter_factory(duplicate_slots)
408 | min_write_buffer_number_to_merge=1
409 | max_write_buffer_number_to_maintain=0
410 | compaction_filter=nullptr
411 | merge_operator=nullptr
412 | num_levels=7
413 | optimize_filters_for_hits=false
414 | force_consistency_checks=true
415 | table_factory=BlockBasedTable
416 | max_write_buffer_size_to_maintain=0
417 | memtable_insert_with_hint_prefix_extractor=nullptr
418 | level_compaction_dynamic_level_bytes=false
419 | inplace_update_support=false
420 |
421 | [TableOptions/BlockBasedTable "duplicate_slots"]
422 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
423 | read_amp_bytes_per_bit=0
424 | verify_compression=false
425 | format_version=4
426 | optimize_filters_for_memory=false
427 | partition_filters=false
428 | enable_index_compression=true
429 | checksum=kCRC32c
430 | index_block_restart_interval=1
431 | pin_top_level_index_and_filter=true
432 | block_align=false
433 | block_size=4096
434 | index_type=kBinarySearch
435 | filter_policy=nullptr
436 | metadata_block_size=4096
437 | no_block_cache=false
438 | whole_key_filtering=true
439 | index_shortening=kShortenSeparators
440 | block_size_deviation=10
441 | data_block_index_type=kDataBlockBinarySearch
442 | data_block_hash_table_util_ratio=0.750000
443 | cache_index_and_filter_blocks=false
444 | block_restart_interval=16
445 | pin_l0_filter_and_index_blocks_in_cache=false
446 | hash_index_allow_collision=true
447 | cache_index_and_filter_blocks_with_high_priority=true
448 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
449 |
450 |
451 | [CFOptions "erasure_meta"]
452 | bottommost_compression=kDisableCompressionOption
453 | sample_for_compression=0
454 | blob_garbage_collection_age_cutoff=0.250000
455 | arena_block_size=33554432
456 | enable_blob_garbage_collection=false
457 | level0_stop_writes_trigger=36
458 | min_blob_size=0
459 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
460 | target_file_size_base=107374182
461 | max_bytes_for_level_base=1073741824
462 | memtable_whole_key_filtering=false
463 | soft_pending_compaction_bytes_limit=68719476736
464 | blob_compression_type=kNoCompression
465 | max_write_buffer_number=8
466 | ttl=2592000
467 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
468 | check_flush_compaction_key_order=true
469 | max_successive_merges=0
470 | inplace_update_num_locks=10000
471 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
472 | target_file_size_multiplier=1
473 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
474 | enable_blob_files=false
475 | level0_slowdown_writes_trigger=20
476 | compression=kNoCompression
477 | level0_file_num_compaction_trigger=4
478 | blob_file_size=268435456
479 | prefix_extractor=nullptr
480 | max_bytes_for_level_multiplier=10.000000
481 | write_buffer_size=268435456
482 | disable_auto_compactions=false
483 | max_compaction_bytes=2684354550
484 | memtable_huge_page_size=0
485 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
486 | hard_pending_compaction_bytes_limit=274877906944
487 | periodic_compaction_seconds=86400
488 | paranoid_file_checks=false
489 | memtable_prefix_bloom_size_ratio=0.000000
490 | max_sequential_skip_in_iterations=8
491 | report_bg_io_stats=false
492 | compaction_pri=kMinOverlappingRatio
493 | compaction_style=kCompactionStyleLevel
494 | memtable_factory=SkipListFactory
495 | comparator=leveldb.BytewiseComparator
496 | bloom_locality=0
497 | compaction_filter_factory=purged_slot_filter_factory(erasure_meta)
498 | min_write_buffer_number_to_merge=1
499 | max_write_buffer_number_to_maintain=0
500 | compaction_filter=nullptr
501 | merge_operator=nullptr
502 | num_levels=7
503 | optimize_filters_for_hits=false
504 | force_consistency_checks=true
505 | table_factory=BlockBasedTable
506 | max_write_buffer_size_to_maintain=0
507 | memtable_insert_with_hint_prefix_extractor=nullptr
508 | level_compaction_dynamic_level_bytes=false
509 | inplace_update_support=false
510 |
511 | [TableOptions/BlockBasedTable "erasure_meta"]
512 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
513 | read_amp_bytes_per_bit=0
514 | verify_compression=false
515 | format_version=4
516 | optimize_filters_for_memory=false
517 | partition_filters=false
518 | enable_index_compression=true
519 | checksum=kCRC32c
520 | index_block_restart_interval=1
521 | pin_top_level_index_and_filter=true
522 | block_align=false
523 | block_size=4096
524 | index_type=kBinarySearch
525 | filter_policy=nullptr
526 | metadata_block_size=4096
527 | no_block_cache=false
528 | whole_key_filtering=true
529 | index_shortening=kShortenSeparators
530 | block_size_deviation=10
531 | data_block_index_type=kDataBlockBinarySearch
532 | data_block_hash_table_util_ratio=0.750000
533 | cache_index_and_filter_blocks=false
534 | block_restart_interval=16
535 | pin_l0_filter_and_index_blocks_in_cache=false
536 | hash_index_allow_collision=true
537 | cache_index_and_filter_blocks_with_high_priority=true
538 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
539 |
540 |
541 | [CFOptions "orphans"]
542 | bottommost_compression=kDisableCompressionOption
543 | sample_for_compression=0
544 | blob_garbage_collection_age_cutoff=0.250000
545 | arena_block_size=33554432
546 | enable_blob_garbage_collection=false
547 | level0_stop_writes_trigger=36
548 | min_blob_size=0
549 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
550 | target_file_size_base=107374182
551 | max_bytes_for_level_base=1073741824
552 | memtable_whole_key_filtering=false
553 | soft_pending_compaction_bytes_limit=68719476736
554 | blob_compression_type=kNoCompression
555 | max_write_buffer_number=8
556 | ttl=2592000
557 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
558 | check_flush_compaction_key_order=true
559 | max_successive_merges=0
560 | inplace_update_num_locks=10000
561 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
562 | target_file_size_multiplier=1
563 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
564 | enable_blob_files=false
565 | level0_slowdown_writes_trigger=20
566 | compression=kNoCompression
567 | level0_file_num_compaction_trigger=4
568 | blob_file_size=268435456
569 | prefix_extractor=nullptr
570 | max_bytes_for_level_multiplier=10.000000
571 | write_buffer_size=268435456
572 | disable_auto_compactions=false
573 | max_compaction_bytes=2684354550
574 | memtable_huge_page_size=0
575 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
576 | hard_pending_compaction_bytes_limit=274877906944
577 | periodic_compaction_seconds=86400
578 | paranoid_file_checks=false
579 | memtable_prefix_bloom_size_ratio=0.000000
580 | max_sequential_skip_in_iterations=8
581 | report_bg_io_stats=false
582 | compaction_pri=kMinOverlappingRatio
583 | compaction_style=kCompactionStyleLevel
584 | memtable_factory=SkipListFactory
585 | comparator=leveldb.BytewiseComparator
586 | bloom_locality=0
587 | compaction_filter_factory=purged_slot_filter_factory(orphans)
588 | min_write_buffer_number_to_merge=1
589 | max_write_buffer_number_to_maintain=0
590 | compaction_filter=nullptr
591 | merge_operator=nullptr
592 | num_levels=7
593 | optimize_filters_for_hits=false
594 | force_consistency_checks=true
595 | table_factory=BlockBasedTable
596 | max_write_buffer_size_to_maintain=0
597 | memtable_insert_with_hint_prefix_extractor=nullptr
598 | level_compaction_dynamic_level_bytes=false
599 | inplace_update_support=false
600 |
601 | [TableOptions/BlockBasedTable "orphans"]
602 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
603 | read_amp_bytes_per_bit=0
604 | verify_compression=false
605 | format_version=4
606 | optimize_filters_for_memory=false
607 | partition_filters=false
608 | enable_index_compression=true
609 | checksum=kCRC32c
610 | index_block_restart_interval=1
611 | pin_top_level_index_and_filter=true
612 | block_align=false
613 | block_size=4096
614 | index_type=kBinarySearch
615 | filter_policy=nullptr
616 | metadata_block_size=4096
617 | no_block_cache=false
618 | whole_key_filtering=true
619 | index_shortening=kShortenSeparators
620 | block_size_deviation=10
621 | data_block_index_type=kDataBlockBinarySearch
622 | data_block_hash_table_util_ratio=0.750000
623 | cache_index_and_filter_blocks=false
624 | block_restart_interval=16
625 | pin_l0_filter_and_index_blocks_in_cache=false
626 | hash_index_allow_collision=true
627 | cache_index_and_filter_blocks_with_high_priority=true
628 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
629 |
630 |
631 | [CFOptions "bank_hashes"]
632 | bottommost_compression=kDisableCompressionOption
633 | sample_for_compression=0
634 | blob_garbage_collection_age_cutoff=0.250000
635 | arena_block_size=33554432
636 | enable_blob_garbage_collection=false
637 | level0_stop_writes_trigger=36
638 | min_blob_size=0
639 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
640 | target_file_size_base=107374182
641 | max_bytes_for_level_base=1073741824
642 | memtable_whole_key_filtering=false
643 | soft_pending_compaction_bytes_limit=68719476736
644 | blob_compression_type=kNoCompression
645 | max_write_buffer_number=8
646 | ttl=2592000
647 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
648 | check_flush_compaction_key_order=true
649 | max_successive_merges=0
650 | inplace_update_num_locks=10000
651 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
652 | target_file_size_multiplier=1
653 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
654 | enable_blob_files=false
655 | level0_slowdown_writes_trigger=20
656 | compression=kNoCompression
657 | level0_file_num_compaction_trigger=4
658 | blob_file_size=268435456
659 | prefix_extractor=nullptr
660 | max_bytes_for_level_multiplier=10.000000
661 | write_buffer_size=268435456
662 | disable_auto_compactions=false
663 | max_compaction_bytes=2684354550
664 | memtable_huge_page_size=0
665 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
666 | hard_pending_compaction_bytes_limit=274877906944
667 | periodic_compaction_seconds=86400
668 | paranoid_file_checks=false
669 | memtable_prefix_bloom_size_ratio=0.000000
670 | max_sequential_skip_in_iterations=8
671 | report_bg_io_stats=false
672 | compaction_pri=kMinOverlappingRatio
673 | compaction_style=kCompactionStyleLevel
674 | memtable_factory=SkipListFactory
675 | comparator=leveldb.BytewiseComparator
676 | bloom_locality=0
677 | compaction_filter_factory=purged_slot_filter_factory(bank_hashes)
678 | min_write_buffer_number_to_merge=1
679 | max_write_buffer_number_to_maintain=0
680 | compaction_filter=nullptr
681 | merge_operator=nullptr
682 | num_levels=7
683 | optimize_filters_for_hits=false
684 | force_consistency_checks=true
685 | table_factory=BlockBasedTable
686 | max_write_buffer_size_to_maintain=0
687 | memtable_insert_with_hint_prefix_extractor=nullptr
688 | level_compaction_dynamic_level_bytes=false
689 | inplace_update_support=false
690 |
691 | [TableOptions/BlockBasedTable "bank_hashes"]
692 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
693 | read_amp_bytes_per_bit=0
694 | verify_compression=false
695 | format_version=4
696 | optimize_filters_for_memory=false
697 | partition_filters=false
698 | enable_index_compression=true
699 | checksum=kCRC32c
700 | index_block_restart_interval=1
701 | pin_top_level_index_and_filter=true
702 | block_align=false
703 | block_size=4096
704 | index_type=kBinarySearch
705 | filter_policy=nullptr
706 | metadata_block_size=4096
707 | no_block_cache=false
708 | whole_key_filtering=true
709 | index_shortening=kShortenSeparators
710 | block_size_deviation=10
711 | data_block_index_type=kDataBlockBinarySearch
712 | data_block_hash_table_util_ratio=0.750000
713 | cache_index_and_filter_blocks=false
714 | block_restart_interval=16
715 | pin_l0_filter_and_index_blocks_in_cache=false
716 | hash_index_allow_collision=true
717 | cache_index_and_filter_blocks_with_high_priority=true
718 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
719 |
720 |
721 | [CFOptions "root"]
722 | bottommost_compression=kDisableCompressionOption
723 | sample_for_compression=0
724 | blob_garbage_collection_age_cutoff=0.250000
725 | arena_block_size=33554432
726 | enable_blob_garbage_collection=false
727 | level0_stop_writes_trigger=36
728 | min_blob_size=0
729 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
730 | target_file_size_base=107374182
731 | max_bytes_for_level_base=1073741824
732 | memtable_whole_key_filtering=false
733 | soft_pending_compaction_bytes_limit=68719476736
734 | blob_compression_type=kNoCompression
735 | max_write_buffer_number=8
736 | ttl=2592000
737 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
738 | check_flush_compaction_key_order=true
739 | max_successive_merges=0
740 | inplace_update_num_locks=10000
741 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
742 | target_file_size_multiplier=1
743 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
744 | enable_blob_files=false
745 | level0_slowdown_writes_trigger=20
746 | compression=kNoCompression
747 | level0_file_num_compaction_trigger=4
748 | blob_file_size=268435456
749 | prefix_extractor=nullptr
750 | max_bytes_for_level_multiplier=10.000000
751 | write_buffer_size=268435456
752 | disable_auto_compactions=false
753 | max_compaction_bytes=2684354550
754 | memtable_huge_page_size=0
755 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
756 | hard_pending_compaction_bytes_limit=274877906944
757 | periodic_compaction_seconds=86400
758 | paranoid_file_checks=false
759 | memtable_prefix_bloom_size_ratio=0.000000
760 | max_sequential_skip_in_iterations=8
761 | report_bg_io_stats=false
762 | compaction_pri=kMinOverlappingRatio
763 | compaction_style=kCompactionStyleLevel
764 | memtable_factory=SkipListFactory
765 | comparator=leveldb.BytewiseComparator
766 | bloom_locality=0
767 | compaction_filter_factory=purged_slot_filter_factory(root)
768 | min_write_buffer_number_to_merge=1
769 | max_write_buffer_number_to_maintain=0
770 | compaction_filter=nullptr
771 | merge_operator=nullptr
772 | num_levels=7
773 | optimize_filters_for_hits=false
774 | force_consistency_checks=true
775 | table_factory=BlockBasedTable
776 | max_write_buffer_size_to_maintain=0
777 | memtable_insert_with_hint_prefix_extractor=nullptr
778 | level_compaction_dynamic_level_bytes=false
779 | inplace_update_support=false
780 |
781 | [TableOptions/BlockBasedTable "root"]
782 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
783 | read_amp_bytes_per_bit=0
784 | verify_compression=false
785 | format_version=4
786 | optimize_filters_for_memory=false
787 | partition_filters=false
788 | enable_index_compression=true
789 | checksum=kCRC32c
790 | index_block_restart_interval=1
791 | pin_top_level_index_and_filter=true
792 | block_align=false
793 | block_size=4096
794 | index_type=kBinarySearch
795 | filter_policy=nullptr
796 | metadata_block_size=4096
797 | no_block_cache=false
798 | whole_key_filtering=true
799 | index_shortening=kShortenSeparators
800 | block_size_deviation=10
801 | data_block_index_type=kDataBlockBinarySearch
802 | data_block_hash_table_util_ratio=0.750000
803 | cache_index_and_filter_blocks=false
804 | block_restart_interval=16
805 | pin_l0_filter_and_index_blocks_in_cache=false
806 | hash_index_allow_collision=true
807 | cache_index_and_filter_blocks_with_high_priority=true
808 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
809 |
810 |
811 | [CFOptions "index"]
812 | bottommost_compression=kDisableCompressionOption
813 | sample_for_compression=0
814 | blob_garbage_collection_age_cutoff=0.250000
815 | arena_block_size=33554432
816 | enable_blob_garbage_collection=false
817 | level0_stop_writes_trigger=36
818 | min_blob_size=0
819 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
820 | target_file_size_base=107374182
821 | max_bytes_for_level_base=1073741824
822 | memtable_whole_key_filtering=false
823 | soft_pending_compaction_bytes_limit=68719476736
824 | blob_compression_type=kNoCompression
825 | max_write_buffer_number=8
826 | ttl=2592000
827 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
828 | check_flush_compaction_key_order=true
829 | max_successive_merges=0
830 | inplace_update_num_locks=10000
831 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
832 | target_file_size_multiplier=1
833 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
834 | enable_blob_files=false
835 | level0_slowdown_writes_trigger=20
836 | compression=kNoCompression
837 | level0_file_num_compaction_trigger=4
838 | blob_file_size=268435456
839 | prefix_extractor=nullptr
840 | max_bytes_for_level_multiplier=10.000000
841 | write_buffer_size=268435456
842 | disable_auto_compactions=false
843 | max_compaction_bytes=2684354550
844 | memtable_huge_page_size=0
845 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
846 | hard_pending_compaction_bytes_limit=274877906944
847 | periodic_compaction_seconds=86400
848 | paranoid_file_checks=false
849 | memtable_prefix_bloom_size_ratio=0.000000
850 | max_sequential_skip_in_iterations=8
851 | report_bg_io_stats=false
852 | compaction_pri=kMinOverlappingRatio
853 | compaction_style=kCompactionStyleLevel
854 | memtable_factory=SkipListFactory
855 | comparator=leveldb.BytewiseComparator
856 | bloom_locality=0
857 | compaction_filter_factory=purged_slot_filter_factory(index)
858 | min_write_buffer_number_to_merge=1
859 | max_write_buffer_number_to_maintain=0
860 | compaction_filter=nullptr
861 | merge_operator=nullptr
862 | num_levels=7
863 | optimize_filters_for_hits=false
864 | force_consistency_checks=true
865 | table_factory=BlockBasedTable
866 | max_write_buffer_size_to_maintain=0
867 | memtable_insert_with_hint_prefix_extractor=nullptr
868 | level_compaction_dynamic_level_bytes=false
869 | inplace_update_support=false
870 |
871 | [TableOptions/BlockBasedTable "index"]
872 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
873 | read_amp_bytes_per_bit=0
874 | verify_compression=false
875 | format_version=4
876 | optimize_filters_for_memory=false
877 | partition_filters=false
878 | enable_index_compression=true
879 | checksum=kCRC32c
880 | index_block_restart_interval=1
881 | pin_top_level_index_and_filter=true
882 | block_align=false
883 | block_size=4096
884 | index_type=kBinarySearch
885 | filter_policy=nullptr
886 | metadata_block_size=4096
887 | no_block_cache=false
888 | whole_key_filtering=true
889 | index_shortening=kShortenSeparators
890 | block_size_deviation=10
891 | data_block_index_type=kDataBlockBinarySearch
892 | data_block_hash_table_util_ratio=0.750000
893 | cache_index_and_filter_blocks=false
894 | block_restart_interval=16
895 | pin_l0_filter_and_index_blocks_in_cache=false
896 | hash_index_allow_collision=true
897 | cache_index_and_filter_blocks_with_high_priority=true
898 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
899 |
900 |
901 | [CFOptions "data_shred"]
902 | bottommost_compression=kDisableCompressionOption
903 | sample_for_compression=0
904 | blob_garbage_collection_age_cutoff=0.250000
905 | arena_block_size=33554432
906 | enable_blob_garbage_collection=false
907 | level0_stop_writes_trigger=36
908 | min_blob_size=0
909 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
910 | target_file_size_base=107374182
911 | max_bytes_for_level_base=1073741824
912 | memtable_whole_key_filtering=false
913 | soft_pending_compaction_bytes_limit=68719476736
914 | blob_compression_type=kNoCompression
915 | max_write_buffer_number=8
916 | ttl=2592000
917 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
918 | check_flush_compaction_key_order=true
919 | max_successive_merges=0
920 | inplace_update_num_locks=10000
921 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
922 | target_file_size_multiplier=1
923 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
924 | enable_blob_files=false
925 | level0_slowdown_writes_trigger=20
926 | compression=kNoCompression
927 | level0_file_num_compaction_trigger=4
928 | blob_file_size=268435456
929 | prefix_extractor=nullptr
930 | max_bytes_for_level_multiplier=10.000000
931 | write_buffer_size=268435456
932 | disable_auto_compactions=false
933 | max_compaction_bytes=2684354550
934 | memtable_huge_page_size=0
935 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
936 | hard_pending_compaction_bytes_limit=274877906944
937 | periodic_compaction_seconds=86400
938 | paranoid_file_checks=false
939 | memtable_prefix_bloom_size_ratio=0.000000
940 | max_sequential_skip_in_iterations=8
941 | report_bg_io_stats=false
942 | compaction_pri=kMinOverlappingRatio
943 | compaction_style=kCompactionStyleLevel
944 | memtable_factory=SkipListFactory
945 | comparator=leveldb.BytewiseComparator
946 | bloom_locality=0
947 | compaction_filter_factory=purged_slot_filter_factory(data_shred)
948 | min_write_buffer_number_to_merge=1
949 | max_write_buffer_number_to_maintain=0
950 | compaction_filter=nullptr
951 | merge_operator=nullptr
952 | num_levels=7
953 | optimize_filters_for_hits=false
954 | force_consistency_checks=true
955 | table_factory=BlockBasedTable
956 | max_write_buffer_size_to_maintain=0
957 | memtable_insert_with_hint_prefix_extractor=nullptr
958 | level_compaction_dynamic_level_bytes=false
959 | inplace_update_support=false
960 |
961 | [TableOptions/BlockBasedTable "data_shred"]
962 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
963 | read_amp_bytes_per_bit=0
964 | verify_compression=false
965 | format_version=4
966 | optimize_filters_for_memory=false
967 | partition_filters=false
968 | enable_index_compression=true
969 | checksum=kCRC32c
970 | index_block_restart_interval=1
971 | pin_top_level_index_and_filter=true
972 | block_align=false
973 | block_size=4096
974 | index_type=kBinarySearch
975 | filter_policy=nullptr
976 | metadata_block_size=4096
977 | no_block_cache=false
978 | whole_key_filtering=true
979 | index_shortening=kShortenSeparators
980 | block_size_deviation=10
981 | data_block_index_type=kDataBlockBinarySearch
982 | data_block_hash_table_util_ratio=0.750000
983 | cache_index_and_filter_blocks=false
984 | block_restart_interval=16
985 | pin_l0_filter_and_index_blocks_in_cache=false
986 | hash_index_allow_collision=true
987 | cache_index_and_filter_blocks_with_high_priority=true
988 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
989 |
990 |
991 | [CFOptions "code_shred"]
992 | bottommost_compression=kDisableCompressionOption
993 | sample_for_compression=0
994 | blob_garbage_collection_age_cutoff=0.250000
995 | arena_block_size=33554432
996 | enable_blob_garbage_collection=false
997 | level0_stop_writes_trigger=36
998 | min_blob_size=0
999 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1000 | target_file_size_base=107374182
1001 | max_bytes_for_level_base=1073741824
1002 | memtable_whole_key_filtering=false
1003 | soft_pending_compaction_bytes_limit=68719476736
1004 | blob_compression_type=kNoCompression
1005 | max_write_buffer_number=8
1006 | ttl=2592000
1007 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1008 | check_flush_compaction_key_order=true
1009 | max_successive_merges=0
1010 | inplace_update_num_locks=10000
1011 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1012 | target_file_size_multiplier=1
1013 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1014 | enable_blob_files=false
1015 | level0_slowdown_writes_trigger=20
1016 | compression=kNoCompression
1017 | level0_file_num_compaction_trigger=4
1018 | blob_file_size=268435456
1019 | prefix_extractor=nullptr
1020 | max_bytes_for_level_multiplier=10.000000
1021 | write_buffer_size=268435456
1022 | disable_auto_compactions=false
1023 | max_compaction_bytes=2684354550
1024 | memtable_huge_page_size=0
1025 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1026 | hard_pending_compaction_bytes_limit=274877906944
1027 | periodic_compaction_seconds=86400
1028 | paranoid_file_checks=false
1029 | memtable_prefix_bloom_size_ratio=0.000000
1030 | max_sequential_skip_in_iterations=8
1031 | report_bg_io_stats=false
1032 | compaction_pri=kMinOverlappingRatio
1033 | compaction_style=kCompactionStyleLevel
1034 | memtable_factory=SkipListFactory
1035 | comparator=leveldb.BytewiseComparator
1036 | bloom_locality=0
1037 | compaction_filter_factory=purged_slot_filter_factory(code_shred)
1038 | min_write_buffer_number_to_merge=1
1039 | max_write_buffer_number_to_maintain=0
1040 | compaction_filter=nullptr
1041 | merge_operator=nullptr
1042 | num_levels=7
1043 | optimize_filters_for_hits=false
1044 | force_consistency_checks=true
1045 | table_factory=BlockBasedTable
1046 | max_write_buffer_size_to_maintain=0
1047 | memtable_insert_with_hint_prefix_extractor=nullptr
1048 | level_compaction_dynamic_level_bytes=false
1049 | inplace_update_support=false
1050 |
1051 | [TableOptions/BlockBasedTable "code_shred"]
1052 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1053 | read_amp_bytes_per_bit=0
1054 | verify_compression=false
1055 | format_version=4
1056 | optimize_filters_for_memory=false
1057 | partition_filters=false
1058 | enable_index_compression=true
1059 | checksum=kCRC32c
1060 | index_block_restart_interval=1
1061 | pin_top_level_index_and_filter=true
1062 | block_align=false
1063 | block_size=4096
1064 | index_type=kBinarySearch
1065 | filter_policy=nullptr
1066 | metadata_block_size=4096
1067 | no_block_cache=false
1068 | whole_key_filtering=true
1069 | index_shortening=kShortenSeparators
1070 | block_size_deviation=10
1071 | data_block_index_type=kDataBlockBinarySearch
1072 | data_block_hash_table_util_ratio=0.750000
1073 | cache_index_and_filter_blocks=false
1074 | block_restart_interval=16
1075 | pin_l0_filter_and_index_blocks_in_cache=false
1076 | hash_index_allow_collision=true
1077 | cache_index_and_filter_blocks_with_high_priority=true
1078 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1079 |
1080 |
1081 | [CFOptions "transaction_status"]
1082 | bottommost_compression=kDisableCompressionOption
1083 | sample_for_compression=0
1084 | blob_garbage_collection_age_cutoff=0.250000
1085 | arena_block_size=33554432
1086 | enable_blob_garbage_collection=false
1087 | level0_stop_writes_trigger=36
1088 | min_blob_size=0
1089 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1090 | target_file_size_base=107374182
1091 | max_bytes_for_level_base=1073741824
1092 | memtable_whole_key_filtering=false
1093 | soft_pending_compaction_bytes_limit=68719476736
1094 | blob_compression_type=kNoCompression
1095 | max_write_buffer_number=8
1096 | ttl=2592000
1097 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1098 | check_flush_compaction_key_order=true
1099 | max_successive_merges=0
1100 | inplace_update_num_locks=10000
1101 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1102 | target_file_size_multiplier=1
1103 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1104 | enable_blob_files=false
1105 | level0_slowdown_writes_trigger=20
1106 | compression=kNoCompression
1107 | level0_file_num_compaction_trigger=4
1108 | blob_file_size=268435456
1109 | prefix_extractor=nullptr
1110 | max_bytes_for_level_multiplier=10.000000
1111 | write_buffer_size=268435456
1112 | disable_auto_compactions=false
1113 | max_compaction_bytes=2684354550
1114 | memtable_huge_page_size=0
1115 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1116 | hard_pending_compaction_bytes_limit=274877906944
1117 | periodic_compaction_seconds=86400
1118 | paranoid_file_checks=false
1119 | memtable_prefix_bloom_size_ratio=0.000000
1120 | max_sequential_skip_in_iterations=8
1121 | report_bg_io_stats=false
1122 | compaction_pri=kMinOverlappingRatio
1123 | compaction_style=kCompactionStyleLevel
1124 | memtable_factory=SkipListFactory
1125 | comparator=leveldb.BytewiseComparator
1126 | bloom_locality=0
1127 | compaction_filter_factory=purged_slot_filter_factory(transaction_status)
1128 | min_write_buffer_number_to_merge=1
1129 | max_write_buffer_number_to_maintain=0
1130 | compaction_filter=nullptr
1131 | merge_operator=nullptr
1132 | num_levels=7
1133 | optimize_filters_for_hits=false
1134 | force_consistency_checks=true
1135 | table_factory=BlockBasedTable
1136 | max_write_buffer_size_to_maintain=0
1137 | memtable_insert_with_hint_prefix_extractor=nullptr
1138 | level_compaction_dynamic_level_bytes=false
1139 | inplace_update_support=false
1140 |
1141 | [TableOptions/BlockBasedTable "transaction_status"]
1142 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1143 | read_amp_bytes_per_bit=0
1144 | verify_compression=false
1145 | format_version=4
1146 | optimize_filters_for_memory=false
1147 | partition_filters=false
1148 | enable_index_compression=true
1149 | checksum=kCRC32c
1150 | index_block_restart_interval=1
1151 | pin_top_level_index_and_filter=true
1152 | block_align=false
1153 | block_size=4096
1154 | index_type=kBinarySearch
1155 | filter_policy=nullptr
1156 | metadata_block_size=4096
1157 | no_block_cache=false
1158 | whole_key_filtering=true
1159 | index_shortening=kShortenSeparators
1160 | block_size_deviation=10
1161 | data_block_index_type=kDataBlockBinarySearch
1162 | data_block_hash_table_util_ratio=0.750000
1163 | cache_index_and_filter_blocks=false
1164 | block_restart_interval=16
1165 | pin_l0_filter_and_index_blocks_in_cache=false
1166 | hash_index_allow_collision=true
1167 | cache_index_and_filter_blocks_with_high_priority=true
1168 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1169 |
1170 |
1171 | [CFOptions "address_signatures"]
1172 | bottommost_compression=kDisableCompressionOption
1173 | sample_for_compression=0
1174 | blob_garbage_collection_age_cutoff=0.250000
1175 | arena_block_size=33554432
1176 | enable_blob_garbage_collection=false
1177 | level0_stop_writes_trigger=36
1178 | min_blob_size=0
1179 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1180 | target_file_size_base=107374182
1181 | max_bytes_for_level_base=1073741824
1182 | memtable_whole_key_filtering=false
1183 | soft_pending_compaction_bytes_limit=68719476736
1184 | blob_compression_type=kNoCompression
1185 | max_write_buffer_number=8
1186 | ttl=2592000
1187 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1188 | check_flush_compaction_key_order=true
1189 | max_successive_merges=0
1190 | inplace_update_num_locks=10000
1191 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1192 | target_file_size_multiplier=1
1193 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1194 | enable_blob_files=false
1195 | level0_slowdown_writes_trigger=20
1196 | compression=kNoCompression
1197 | level0_file_num_compaction_trigger=4
1198 | blob_file_size=268435456
1199 | prefix_extractor=nullptr
1200 | max_bytes_for_level_multiplier=10.000000
1201 | write_buffer_size=268435456
1202 | disable_auto_compactions=false
1203 | max_compaction_bytes=2684354550
1204 | memtable_huge_page_size=0
1205 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1206 | hard_pending_compaction_bytes_limit=274877906944
1207 | periodic_compaction_seconds=86400
1208 | paranoid_file_checks=false
1209 | memtable_prefix_bloom_size_ratio=0.000000
1210 | max_sequential_skip_in_iterations=8
1211 | report_bg_io_stats=false
1212 | compaction_pri=kMinOverlappingRatio
1213 | compaction_style=kCompactionStyleLevel
1214 | memtable_factory=SkipListFactory
1215 | comparator=leveldb.BytewiseComparator
1216 | bloom_locality=0
1217 | compaction_filter_factory=purged_slot_filter_factory(address_signatures)
1218 | min_write_buffer_number_to_merge=1
1219 | max_write_buffer_number_to_maintain=0
1220 | compaction_filter=nullptr
1221 | merge_operator=nullptr
1222 | num_levels=7
1223 | optimize_filters_for_hits=false
1224 | force_consistency_checks=true
1225 | table_factory=BlockBasedTable
1226 | max_write_buffer_size_to_maintain=0
1227 | memtable_insert_with_hint_prefix_extractor=nullptr
1228 | level_compaction_dynamic_level_bytes=false
1229 | inplace_update_support=false
1230 |
1231 | [TableOptions/BlockBasedTable "address_signatures"]
1232 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1233 | read_amp_bytes_per_bit=0
1234 | verify_compression=false
1235 | format_version=4
1236 | optimize_filters_for_memory=false
1237 | partition_filters=false
1238 | enable_index_compression=true
1239 | checksum=kCRC32c
1240 | index_block_restart_interval=1
1241 | pin_top_level_index_and_filter=true
1242 | block_align=false
1243 | block_size=4096
1244 | index_type=kBinarySearch
1245 | filter_policy=nullptr
1246 | metadata_block_size=4096
1247 | no_block_cache=false
1248 | whole_key_filtering=true
1249 | index_shortening=kShortenSeparators
1250 | block_size_deviation=10
1251 | data_block_index_type=kDataBlockBinarySearch
1252 | data_block_hash_table_util_ratio=0.750000
1253 | cache_index_and_filter_blocks=false
1254 | block_restart_interval=16
1255 | pin_l0_filter_and_index_blocks_in_cache=false
1256 | hash_index_allow_collision=true
1257 | cache_index_and_filter_blocks_with_high_priority=true
1258 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1259 |
1260 |
1261 | [CFOptions "transaction_memos"]
1262 | bottommost_compression=kDisableCompressionOption
1263 | sample_for_compression=0
1264 | blob_garbage_collection_age_cutoff=0.250000
1265 | arena_block_size=33554432
1266 | enable_blob_garbage_collection=false
1267 | level0_stop_writes_trigger=36
1268 | min_blob_size=0
1269 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1270 | target_file_size_base=107374182
1271 | max_bytes_for_level_base=1073741824
1272 | memtable_whole_key_filtering=false
1273 | soft_pending_compaction_bytes_limit=68719476736
1274 | blob_compression_type=kNoCompression
1275 | max_write_buffer_number=8
1276 | ttl=2592000
1277 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1278 | check_flush_compaction_key_order=true
1279 | max_successive_merges=0
1280 | inplace_update_num_locks=10000
1281 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1282 | target_file_size_multiplier=1
1283 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1284 | enable_blob_files=false
1285 | level0_slowdown_writes_trigger=20
1286 | compression=kNoCompression
1287 | level0_file_num_compaction_trigger=4
1288 | blob_file_size=268435456
1289 | prefix_extractor=nullptr
1290 | max_bytes_for_level_multiplier=10.000000
1291 | write_buffer_size=268435456
1292 | disable_auto_compactions=false
1293 | max_compaction_bytes=2684354550
1294 | memtable_huge_page_size=0
1295 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1296 | hard_pending_compaction_bytes_limit=274877906944
1297 | periodic_compaction_seconds=0
1298 | paranoid_file_checks=false
1299 | memtable_prefix_bloom_size_ratio=0.000000
1300 | max_sequential_skip_in_iterations=8
1301 | report_bg_io_stats=false
1302 | compaction_pri=kMinOverlappingRatio
1303 | compaction_style=kCompactionStyleLevel
1304 | memtable_factory=SkipListFactory
1305 | comparator=leveldb.BytewiseComparator
1306 | bloom_locality=0
1307 | compaction_filter_factory=nullptr
1308 | min_write_buffer_number_to_merge=1
1309 | max_write_buffer_number_to_maintain=0
1310 | compaction_filter=nullptr
1311 | merge_operator=nullptr
1312 | num_levels=7
1313 | optimize_filters_for_hits=false
1314 | force_consistency_checks=true
1315 | table_factory=BlockBasedTable
1316 | max_write_buffer_size_to_maintain=0
1317 | memtable_insert_with_hint_prefix_extractor=nullptr
1318 | level_compaction_dynamic_level_bytes=false
1319 | inplace_update_support=false
1320 |
1321 | [TableOptions/BlockBasedTable "transaction_memos"]
1322 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1323 | read_amp_bytes_per_bit=0
1324 | verify_compression=false
1325 | format_version=4
1326 | optimize_filters_for_memory=false
1327 | partition_filters=false
1328 | enable_index_compression=true
1329 | checksum=kCRC32c
1330 | index_block_restart_interval=1
1331 | pin_top_level_index_and_filter=true
1332 | block_align=false
1333 | block_size=4096
1334 | index_type=kBinarySearch
1335 | filter_policy=nullptr
1336 | metadata_block_size=4096
1337 | no_block_cache=false
1338 | whole_key_filtering=true
1339 | index_shortening=kShortenSeparators
1340 | block_size_deviation=10
1341 | data_block_index_type=kDataBlockBinarySearch
1342 | data_block_hash_table_util_ratio=0.750000
1343 | cache_index_and_filter_blocks=false
1344 | block_restart_interval=16
1345 | pin_l0_filter_and_index_blocks_in_cache=false
1346 | hash_index_allow_collision=true
1347 | cache_index_and_filter_blocks_with_high_priority=true
1348 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1349 |
1350 |
1351 | [CFOptions "transaction_status_index"]
1352 | bottommost_compression=kDisableCompressionOption
1353 | sample_for_compression=0
1354 | blob_garbage_collection_age_cutoff=0.250000
1355 | arena_block_size=33554432
1356 | enable_blob_garbage_collection=false
1357 | level0_stop_writes_trigger=36
1358 | min_blob_size=0
1359 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1360 | target_file_size_base=107374182
1361 | max_bytes_for_level_base=1073741824
1362 | memtable_whole_key_filtering=false
1363 | soft_pending_compaction_bytes_limit=68719476736
1364 | blob_compression_type=kNoCompression
1365 | max_write_buffer_number=8
1366 | ttl=2592000
1367 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1368 | check_flush_compaction_key_order=true
1369 | max_successive_merges=0
1370 | inplace_update_num_locks=10000
1371 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1372 | target_file_size_multiplier=1
1373 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1374 | enable_blob_files=false
1375 | level0_slowdown_writes_trigger=20
1376 | compression=kNoCompression
1377 | level0_file_num_compaction_trigger=4
1378 | blob_file_size=268435456
1379 | prefix_extractor=nullptr
1380 | max_bytes_for_level_multiplier=10.000000
1381 | write_buffer_size=268435456
1382 | disable_auto_compactions=false
1383 | max_compaction_bytes=2684354550
1384 | memtable_huge_page_size=0
1385 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1386 | hard_pending_compaction_bytes_limit=274877906944
1387 | periodic_compaction_seconds=0
1388 | paranoid_file_checks=false
1389 | memtable_prefix_bloom_size_ratio=0.000000
1390 | max_sequential_skip_in_iterations=8
1391 | report_bg_io_stats=false
1392 | compaction_pri=kMinOverlappingRatio
1393 | compaction_style=kCompactionStyleLevel
1394 | memtable_factory=SkipListFactory
1395 | comparator=leveldb.BytewiseComparator
1396 | bloom_locality=0
1397 | compaction_filter_factory=nullptr
1398 | min_write_buffer_number_to_merge=1
1399 | max_write_buffer_number_to_maintain=0
1400 | compaction_filter=nullptr
1401 | merge_operator=nullptr
1402 | num_levels=7
1403 | optimize_filters_for_hits=false
1404 | force_consistency_checks=true
1405 | table_factory=BlockBasedTable
1406 | max_write_buffer_size_to_maintain=0
1407 | memtable_insert_with_hint_prefix_extractor=nullptr
1408 | level_compaction_dynamic_level_bytes=false
1409 | inplace_update_support=false
1410 |
1411 | [TableOptions/BlockBasedTable "transaction_status_index"]
1412 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1413 | read_amp_bytes_per_bit=0
1414 | verify_compression=false
1415 | format_version=4
1416 | optimize_filters_for_memory=false
1417 | partition_filters=false
1418 | enable_index_compression=true
1419 | checksum=kCRC32c
1420 | index_block_restart_interval=1
1421 | pin_top_level_index_and_filter=true
1422 | block_align=false
1423 | block_size=4096
1424 | index_type=kBinarySearch
1425 | filter_policy=nullptr
1426 | metadata_block_size=4096
1427 | no_block_cache=false
1428 | whole_key_filtering=true
1429 | index_shortening=kShortenSeparators
1430 | block_size_deviation=10
1431 | data_block_index_type=kDataBlockBinarySearch
1432 | data_block_hash_table_util_ratio=0.750000
1433 | cache_index_and_filter_blocks=false
1434 | block_restart_interval=16
1435 | pin_l0_filter_and_index_blocks_in_cache=false
1436 | hash_index_allow_collision=true
1437 | cache_index_and_filter_blocks_with_high_priority=true
1438 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1439 |
1440 |
1441 | [CFOptions "rewards"]
1442 | bottommost_compression=kDisableCompressionOption
1443 | sample_for_compression=0
1444 | blob_garbage_collection_age_cutoff=0.250000
1445 | arena_block_size=33554432
1446 | enable_blob_garbage_collection=false
1447 | level0_stop_writes_trigger=36
1448 | min_blob_size=0
1449 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1450 | target_file_size_base=107374182
1451 | max_bytes_for_level_base=1073741824
1452 | memtable_whole_key_filtering=false
1453 | soft_pending_compaction_bytes_limit=68719476736
1454 | blob_compression_type=kNoCompression
1455 | max_write_buffer_number=8
1456 | ttl=2592000
1457 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1458 | check_flush_compaction_key_order=true
1459 | max_successive_merges=0
1460 | inplace_update_num_locks=10000
1461 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1462 | target_file_size_multiplier=1
1463 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1464 | enable_blob_files=false
1465 | level0_slowdown_writes_trigger=20
1466 | compression=kNoCompression
1467 | level0_file_num_compaction_trigger=4
1468 | blob_file_size=268435456
1469 | prefix_extractor=nullptr
1470 | max_bytes_for_level_multiplier=10.000000
1471 | write_buffer_size=268435456
1472 | disable_auto_compactions=false
1473 | max_compaction_bytes=2684354550
1474 | memtable_huge_page_size=0
1475 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1476 | hard_pending_compaction_bytes_limit=274877906944
1477 | periodic_compaction_seconds=86400
1478 | paranoid_file_checks=false
1479 | memtable_prefix_bloom_size_ratio=0.000000
1480 | max_sequential_skip_in_iterations=8
1481 | report_bg_io_stats=false
1482 | compaction_pri=kMinOverlappingRatio
1483 | compaction_style=kCompactionStyleLevel
1484 | memtable_factory=SkipListFactory
1485 | comparator=leveldb.BytewiseComparator
1486 | bloom_locality=0
1487 | compaction_filter_factory=purged_slot_filter_factory(rewards)
1488 | min_write_buffer_number_to_merge=1
1489 | max_write_buffer_number_to_maintain=0
1490 | compaction_filter=nullptr
1491 | merge_operator=nullptr
1492 | num_levels=7
1493 | optimize_filters_for_hits=false
1494 | force_consistency_checks=true
1495 | table_factory=BlockBasedTable
1496 | max_write_buffer_size_to_maintain=0
1497 | memtable_insert_with_hint_prefix_extractor=nullptr
1498 | level_compaction_dynamic_level_bytes=false
1499 | inplace_update_support=false
1500 |
1501 | [TableOptions/BlockBasedTable "rewards"]
1502 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1503 | read_amp_bytes_per_bit=0
1504 | verify_compression=false
1505 | format_version=4
1506 | optimize_filters_for_memory=false
1507 | partition_filters=false
1508 | enable_index_compression=true
1509 | checksum=kCRC32c
1510 | index_block_restart_interval=1
1511 | pin_top_level_index_and_filter=true
1512 | block_align=false
1513 | block_size=4096
1514 | index_type=kBinarySearch
1515 | filter_policy=nullptr
1516 | metadata_block_size=4096
1517 | no_block_cache=false
1518 | whole_key_filtering=true
1519 | index_shortening=kShortenSeparators
1520 | block_size_deviation=10
1521 | data_block_index_type=kDataBlockBinarySearch
1522 | data_block_hash_table_util_ratio=0.750000
1523 | cache_index_and_filter_blocks=false
1524 | block_restart_interval=16
1525 | pin_l0_filter_and_index_blocks_in_cache=false
1526 | hash_index_allow_collision=true
1527 | cache_index_and_filter_blocks_with_high_priority=true
1528 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1529 |
1530 |
1531 | [CFOptions "blocktime"]
1532 | bottommost_compression=kDisableCompressionOption
1533 | sample_for_compression=0
1534 | blob_garbage_collection_age_cutoff=0.250000
1535 | arena_block_size=33554432
1536 | enable_blob_garbage_collection=false
1537 | level0_stop_writes_trigger=36
1538 | min_blob_size=0
1539 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1540 | target_file_size_base=107374182
1541 | max_bytes_for_level_base=1073741824
1542 | memtable_whole_key_filtering=false
1543 | soft_pending_compaction_bytes_limit=68719476736
1544 | blob_compression_type=kNoCompression
1545 | max_write_buffer_number=8
1546 | ttl=2592000
1547 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1548 | check_flush_compaction_key_order=true
1549 | max_successive_merges=0
1550 | inplace_update_num_locks=10000
1551 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1552 | target_file_size_multiplier=1
1553 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1554 | enable_blob_files=false
1555 | level0_slowdown_writes_trigger=20
1556 | compression=kNoCompression
1557 | level0_file_num_compaction_trigger=4
1558 | blob_file_size=268435456
1559 | prefix_extractor=nullptr
1560 | max_bytes_for_level_multiplier=10.000000
1561 | write_buffer_size=268435456
1562 | disable_auto_compactions=false
1563 | max_compaction_bytes=2684354550
1564 | memtable_huge_page_size=0
1565 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1566 | hard_pending_compaction_bytes_limit=274877906944
1567 | periodic_compaction_seconds=86400
1568 | paranoid_file_checks=false
1569 | memtable_prefix_bloom_size_ratio=0.000000
1570 | max_sequential_skip_in_iterations=8
1571 | report_bg_io_stats=false
1572 | compaction_pri=kMinOverlappingRatio
1573 | compaction_style=kCompactionStyleLevel
1574 | memtable_factory=SkipListFactory
1575 | comparator=leveldb.BytewiseComparator
1576 | bloom_locality=0
1577 | compaction_filter_factory=purged_slot_filter_factory(blocktime)
1578 | min_write_buffer_number_to_merge=1
1579 | max_write_buffer_number_to_maintain=0
1580 | compaction_filter=nullptr
1581 | merge_operator=nullptr
1582 | num_levels=7
1583 | optimize_filters_for_hits=false
1584 | force_consistency_checks=true
1585 | table_factory=BlockBasedTable
1586 | max_write_buffer_size_to_maintain=0
1587 | memtable_insert_with_hint_prefix_extractor=nullptr
1588 | level_compaction_dynamic_level_bytes=false
1589 | inplace_update_support=false
1590 |
1591 | [TableOptions/BlockBasedTable "blocktime"]
1592 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1593 | read_amp_bytes_per_bit=0
1594 | verify_compression=false
1595 | format_version=4
1596 | optimize_filters_for_memory=false
1597 | partition_filters=false
1598 | enable_index_compression=true
1599 | checksum=kCRC32c
1600 | index_block_restart_interval=1
1601 | pin_top_level_index_and_filter=true
1602 | block_align=false
1603 | block_size=4096
1604 | index_type=kBinarySearch
1605 | filter_policy=nullptr
1606 | metadata_block_size=4096
1607 | no_block_cache=false
1608 | whole_key_filtering=true
1609 | index_shortening=kShortenSeparators
1610 | block_size_deviation=10
1611 | data_block_index_type=kDataBlockBinarySearch
1612 | data_block_hash_table_util_ratio=0.750000
1613 | cache_index_and_filter_blocks=false
1614 | block_restart_interval=16
1615 | pin_l0_filter_and_index_blocks_in_cache=false
1616 | hash_index_allow_collision=true
1617 | cache_index_and_filter_blocks_with_high_priority=true
1618 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1619 |
1620 |
1621 | [CFOptions "perf_samples"]
1622 | bottommost_compression=kDisableCompressionOption
1623 | sample_for_compression=0
1624 | blob_garbage_collection_age_cutoff=0.250000
1625 | arena_block_size=33554432
1626 | enable_blob_garbage_collection=false
1627 | level0_stop_writes_trigger=36
1628 | min_blob_size=0
1629 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1630 | target_file_size_base=107374182
1631 | max_bytes_for_level_base=1073741824
1632 | memtable_whole_key_filtering=false
1633 | soft_pending_compaction_bytes_limit=68719476736
1634 | blob_compression_type=kNoCompression
1635 | max_write_buffer_number=8
1636 | ttl=2592000
1637 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1638 | check_flush_compaction_key_order=true
1639 | max_successive_merges=0
1640 | inplace_update_num_locks=10000
1641 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1642 | target_file_size_multiplier=1
1643 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1644 | enable_blob_files=false
1645 | level0_slowdown_writes_trigger=20
1646 | compression=kNoCompression
1647 | level0_file_num_compaction_trigger=4
1648 | blob_file_size=268435456
1649 | prefix_extractor=nullptr
1650 | max_bytes_for_level_multiplier=10.000000
1651 | write_buffer_size=268435456
1652 | disable_auto_compactions=false
1653 | max_compaction_bytes=2684354550
1654 | memtable_huge_page_size=0
1655 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1656 | hard_pending_compaction_bytes_limit=274877906944
1657 | periodic_compaction_seconds=86400
1658 | paranoid_file_checks=false
1659 | memtable_prefix_bloom_size_ratio=0.000000
1660 | max_sequential_skip_in_iterations=8
1661 | report_bg_io_stats=false
1662 | compaction_pri=kMinOverlappingRatio
1663 | compaction_style=kCompactionStyleLevel
1664 | memtable_factory=SkipListFactory
1665 | comparator=leveldb.BytewiseComparator
1666 | bloom_locality=0
1667 | compaction_filter_factory=purged_slot_filter_factory(perf_samples)
1668 | min_write_buffer_number_to_merge=1
1669 | max_write_buffer_number_to_maintain=0
1670 | compaction_filter=nullptr
1671 | merge_operator=nullptr
1672 | num_levels=7
1673 | optimize_filters_for_hits=false
1674 | force_consistency_checks=true
1675 | table_factory=BlockBasedTable
1676 | max_write_buffer_size_to_maintain=0
1677 | memtable_insert_with_hint_prefix_extractor=nullptr
1678 | level_compaction_dynamic_level_bytes=false
1679 | inplace_update_support=false
1680 |
1681 | [TableOptions/BlockBasedTable "perf_samples"]
1682 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1683 | read_amp_bytes_per_bit=0
1684 | verify_compression=false
1685 | format_version=4
1686 | optimize_filters_for_memory=false
1687 | partition_filters=false
1688 | enable_index_compression=true
1689 | checksum=kCRC32c
1690 | index_block_restart_interval=1
1691 | pin_top_level_index_and_filter=true
1692 | block_align=false
1693 | block_size=4096
1694 | index_type=kBinarySearch
1695 | filter_policy=nullptr
1696 | metadata_block_size=4096
1697 | no_block_cache=false
1698 | whole_key_filtering=true
1699 | index_shortening=kShortenSeparators
1700 | block_size_deviation=10
1701 | data_block_index_type=kDataBlockBinarySearch
1702 | data_block_hash_table_util_ratio=0.750000
1703 | cache_index_and_filter_blocks=false
1704 | block_restart_interval=16
1705 | pin_l0_filter_and_index_blocks_in_cache=false
1706 | hash_index_allow_collision=true
1707 | cache_index_and_filter_blocks_with_high_priority=true
1708 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1709 |
1710 |
1711 | [CFOptions "block_height"]
1712 | bottommost_compression=kDisableCompressionOption
1713 | sample_for_compression=0
1714 | blob_garbage_collection_age_cutoff=0.250000
1715 | arena_block_size=33554432
1716 | enable_blob_garbage_collection=false
1717 | level0_stop_writes_trigger=36
1718 | min_blob_size=0
1719 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1720 | target_file_size_base=107374182
1721 | max_bytes_for_level_base=1073741824
1722 | memtable_whole_key_filtering=false
1723 | soft_pending_compaction_bytes_limit=68719476736
1724 | blob_compression_type=kNoCompression
1725 | max_write_buffer_number=8
1726 | ttl=2592000
1727 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1728 | check_flush_compaction_key_order=true
1729 | max_successive_merges=0
1730 | inplace_update_num_locks=10000
1731 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1732 | target_file_size_multiplier=1
1733 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1734 | enable_blob_files=false
1735 | level0_slowdown_writes_trigger=20
1736 | compression=kNoCompression
1737 | level0_file_num_compaction_trigger=4
1738 | blob_file_size=268435456
1739 | prefix_extractor=nullptr
1740 | max_bytes_for_level_multiplier=10.000000
1741 | write_buffer_size=268435456
1742 | disable_auto_compactions=false
1743 | max_compaction_bytes=2684354550
1744 | memtable_huge_page_size=0
1745 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1746 | hard_pending_compaction_bytes_limit=274877906944
1747 | periodic_compaction_seconds=2592000
1748 | paranoid_file_checks=false
1749 | memtable_prefix_bloom_size_ratio=0.000000
1750 | max_sequential_skip_in_iterations=8
1751 | report_bg_io_stats=false
1752 | compaction_pri=kMinOverlappingRatio
1753 | compaction_style=kCompactionStyleLevel
1754 | memtable_factory=SkipListFactory
1755 | comparator=leveldb.BytewiseComparator
1756 | bloom_locality=0
1757 | compaction_filter_factory=purged_slot_filter_factory(block_height)
1758 | min_write_buffer_number_to_merge=1
1759 | max_write_buffer_number_to_maintain=0
1760 | compaction_filter=nullptr
1761 | merge_operator=nullptr
1762 | num_levels=7
1763 | optimize_filters_for_hits=false
1764 | force_consistency_checks=true
1765 | table_factory=BlockBasedTable
1766 | max_write_buffer_size_to_maintain=0
1767 | memtable_insert_with_hint_prefix_extractor=nullptr
1768 | level_compaction_dynamic_level_bytes=false
1769 | inplace_update_support=false
1770 |
1771 | [TableOptions/BlockBasedTable "block_height"]
1772 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1773 | read_amp_bytes_per_bit=0
1774 | verify_compression=false
1775 | format_version=4
1776 | optimize_filters_for_memory=false
1777 | partition_filters=false
1778 | enable_index_compression=true
1779 | checksum=kCRC32c
1780 | index_block_restart_interval=1
1781 | pin_top_level_index_and_filter=true
1782 | block_align=false
1783 | block_size=4096
1784 | index_type=kBinarySearch
1785 | filter_policy=nullptr
1786 | metadata_block_size=4096
1787 | no_block_cache=false
1788 | whole_key_filtering=true
1789 | index_shortening=kShortenSeparators
1790 | block_size_deviation=10
1791 | data_block_index_type=kDataBlockBinarySearch
1792 | data_block_hash_table_util_ratio=0.750000
1793 | cache_index_and_filter_blocks=false
1794 | block_restart_interval=16
1795 | pin_l0_filter_and_index_blocks_in_cache=false
1796 | hash_index_allow_collision=true
1797 | cache_index_and_filter_blocks_with_high_priority=true
1798 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1799 |
1800 |
1801 | [CFOptions "program_costs"]
1802 | bottommost_compression=kDisableCompressionOption
1803 | sample_for_compression=0
1804 | blob_garbage_collection_age_cutoff=0.250000
1805 | arena_block_size=33554432
1806 | enable_blob_garbage_collection=false
1807 | level0_stop_writes_trigger=36
1808 | min_blob_size=0
1809 | compaction_options_universal={allow_trivial_move=false;stop_style=kCompactionStopStyleTotalSize;min_merge_width=2;compression_size_percent=-1;max_size_amplification_percent=200;max_merge_width=4294967295;size_ratio=1;}
1810 | target_file_size_base=107374182
1811 | max_bytes_for_level_base=1073741824
1812 | memtable_whole_key_filtering=false
1813 | soft_pending_compaction_bytes_limit=68719476736
1814 | blob_compression_type=kNoCompression
1815 | max_write_buffer_number=8
1816 | ttl=2592000
1817 | compaction_options_fifo={allow_compaction=false;max_table_files_size=1073741824;}
1818 | check_flush_compaction_key_order=true
1819 | max_successive_merges=0
1820 | inplace_update_num_locks=10000
1821 | bottommost_compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1822 | target_file_size_multiplier=1
1823 | max_bytes_for_level_multiplier_additional=1:{1}:{1}:{1}:{1}:{1}:{1}
1824 | enable_blob_files=false
1825 | level0_slowdown_writes_trigger=20
1826 | compression=kNoCompression
1827 | level0_file_num_compaction_trigger=4
1828 | blob_file_size=268435456
1829 | prefix_extractor=nullptr
1830 | max_bytes_for_level_multiplier=10.000000
1831 | write_buffer_size=268435456
1832 | disable_auto_compactions=false
1833 | max_compaction_bytes=2684354550
1834 | memtable_huge_page_size=0
1835 | compression_opts={enabled=false;parallel_threads=1;zstd_max_train_bytes=0;max_dict_bytes=0;strategy=0;level=32767;window_bits=-14;}
1836 | hard_pending_compaction_bytes_limit=274877906944
1837 | periodic_compaction_seconds=0
1838 | paranoid_file_checks=false
1839 | memtable_prefix_bloom_size_ratio=0.000000
1840 | max_sequential_skip_in_iterations=8
1841 | report_bg_io_stats=false
1842 | compaction_pri=kMinOverlappingRatio
1843 | compaction_style=kCompactionStyleLevel
1844 | memtable_factory=SkipListFactory
1845 | comparator=leveldb.BytewiseComparator
1846 | bloom_locality=0
1847 | compaction_filter_factory=nullptr
1848 | min_write_buffer_number_to_merge=1
1849 | max_write_buffer_number_to_maintain=0
1850 | compaction_filter=nullptr
1851 | merge_operator=nullptr
1852 | num_levels=7
1853 | optimize_filters_for_hits=false
1854 | force_consistency_checks=true
1855 | table_factory=BlockBasedTable
1856 | max_write_buffer_size_to_maintain=0
1857 | memtable_insert_with_hint_prefix_extractor=nullptr
1858 | level_compaction_dynamic_level_bytes=false
1859 | inplace_update_support=false
1860 |
1861 | [TableOptions/BlockBasedTable "program_costs"]
1862 | metadata_cache_options={unpartitioned_pinning=kFallback;partition_pinning=kFallback;top_level_index_pinning=kFallback;}
1863 | read_amp_bytes_per_bit=0
1864 | verify_compression=false
1865 | format_version=4
1866 | optimize_filters_for_memory=false
1867 | partition_filters=false
1868 | enable_index_compression=true
1869 | checksum=kCRC32c
1870 | index_block_restart_interval=1
1871 | pin_top_level_index_and_filter=true
1872 | block_align=false
1873 | block_size=4096
1874 | index_type=kBinarySearch
1875 | filter_policy=nullptr
1876 | metadata_block_size=4096
1877 | no_block_cache=false
1878 | whole_key_filtering=true
1879 | index_shortening=kShortenSeparators
1880 | block_size_deviation=10
1881 | data_block_index_type=kDataBlockBinarySearch
1882 | data_block_hash_table_util_ratio=0.750000
1883 | cache_index_and_filter_blocks=false
1884 | block_restart_interval=16
1885 | pin_l0_filter_and_index_blocks_in_cache=false
1886 | hash_index_allow_collision=true
1887 | cache_index_and_filter_blocks_with_high_priority=true
1888 | flush_block_policy_factory=FlushBlockBySizePolicyFactory
1889 |
1890 |
--------------------------------------------------------------------------------
/test-ledger/tower-4u5QPTpzJkeRMzzGpyuGP51zReWUcYg6bFTNBK5bwCR4.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imrenagi/design-pattern/7ca95135b1db9910d92c81d19be24a66948eeb7f/test-ledger/tower-4u5QPTpzJkeRMzzGpyuGP51zReWUcYg6bFTNBK5bwCR4.bin
--------------------------------------------------------------------------------
/test-ledger/validator-keypair.json:
--------------------------------------------------------------------------------
1 | [55,178,125,199,139,207,143,200,236,24,228,159,229,211,232,157,93,235,175,53,78,168,152,33,64,196,138,135,101,178,72,185,57,234,61,217,92,143,118,3,93,219,182,125,212,195,89,235,247,10,58,19,206,112,45,150,64,204,144,99,31,181,87,143]
--------------------------------------------------------------------------------
/test-ledger/validator.log:
--------------------------------------------------------------------------------
1 | validator-1638084176600.log
--------------------------------------------------------------------------------
/test-ledger/vote-account-keypair.json:
--------------------------------------------------------------------------------
1 | [110,194,99,176,19,246,127,5,223,181,83,180,197,168,22,177,17,84,153,41,89,37,183,118,156,177,55,96,105,249,133,207,111,74,82,158,155,18,2,176,227,157,88,74,128,239,181,27,239,176,54,72,170,197,122,11,43,63,156,158,59,134,141,121]
--------------------------------------------------------------------------------
/visitor/dentist/dentist.go:
--------------------------------------------------------------------------------
1 | package dentist
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/imrenagi/design-pattern/visitor"
7 | )
8 |
9 | type Spesialis struct {}
10 |
11 | func (s Spesialis) GetSex() visitor.Sex {
12 | return visitor.Male
13 | }
14 |
15 | func (s Spesialis) DoScaling(p visitor.Patient) {
16 | fmt.Println("mohon maaf tidak melayani scaling")
17 | }
18 |
19 | func (s Spesialis) DoToothFilling(p visitor.Patient) {
20 | fmt.Println("lakukan tambal gigi")
21 | }
22 |
23 | type Drg struct {
24 | }
25 |
26 | func (d Drg) GetSex() visitor.Sex {
27 | return visitor.Female
28 | }
29 |
30 | func (d Drg) DoScaling(p visitor.Patient) {
31 | d.ManualScaling()
32 | }
33 |
34 | func (d Drg) ManualScaling() {
35 | fmt.Println("do manual scaling")
36 | }
37 |
38 | func (d Drg) AutomaticScaling() {
39 | fmt.Println("do scaling with machine")
40 | }
41 |
42 | func (d Drg) DoToothFilling(p visitor.Patient) {
43 | fmt.Println("mohon maaf alat tambal gigi lagi rusak")
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/visitor/interface.go:
--------------------------------------------------------------------------------
1 | package visitor
2 |
3 | type Sex string
4 |
5 | const (
6 | Female Sex = "female"
7 | Male Sex = "male"
8 | )
9 |
10 | type Dentist interface {
11 | GetSex() Sex
12 | DoScaling(p Patient)
13 | DoToothFilling(p Patient)
14 | }
15 |
16 | type Patient interface {
17 | Accept(d Dentist)
18 | CountKarangGigi() int
19 | }
20 |
--------------------------------------------------------------------------------
/visitor/patient/patient.go:
--------------------------------------------------------------------------------
1 | package patient
2 |
3 | import (
4 | "github.com/imrenagi/design-pattern/visitor"
5 | )
6 |
7 | type KarangGigiPatient struct {
8 | SexPreference visitor.Sex
9 | }
10 |
11 | func (kgp *KarangGigiPatient) Accept(d visitor.Dentist) {
12 | if d.GetSex() == kgp.SexPreference {
13 | d.DoScaling(kgp)
14 | }
15 | }
16 |
17 | func (kgp KarangGigiPatient) CountKarangGigi() int {
18 | return 0
19 | }
20 |
21 | type GigiBerlubangPatient struct {
22 | }
23 |
24 | func (gbp *GigiBerlubangPatient) Accept(d visitor.Dentist) {
25 | d.DoToothFilling(gbp)
26 | }
27 |
28 | func (gbp *GigiBerlubangPatient) CountKarangGigi() int {
29 | return 0
30 | }
--------------------------------------------------------------------------------