From bb750bf7272d6e79b2fa337210968e06bcf82444 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Sun, 24 Jan 2016 19:49:57 +0300 Subject: [PATCH] Rename to Shezmu --- README.md | 4 ++-- caller/README.md | 6 +++--- daemon.go | 8 ++++---- dashboard/package.json | 2 +- example/README.md | 2 +- example/daemons/number_printer.go | 6 +++--- example/daemons/price_consumer.go | 4 ++-- example/kafka/kafka.go | 12 ++++++------ example/main.go | 12 ++++++------ server/server.go | 2 +- satan.go => shezmu.go | 28 ++++++++++++++-------------- submodules-to-glockfile.py | 2 +- 12 files changed, 44 insertions(+), 44 deletions(-) rename satan.go => shezmu.go (90%) diff --git a/README.md b/README.md index 0dc4f85..9eae780 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Satan +# Shezmu -Satan is a daemon execution platform for Go apps. +Shezmu is a daemon execution platform for Go apps. * What is a daemon execution platform? * What does it provide? diff --git a/caller/README.md b/caller/README.md index a0c1dbe..a172ab1 100644 --- a/caller/README.md +++ b/caller/README.md @@ -5,7 +5,7 @@ into the functions' first argument. Its main purpose is to hide common unmarshalling code from each function implementation thus reducing boilerplate and making package interaction code sexier. -[Documentation](https://godoc.org/github.com/localhots/satan/caller) +[Documentation](https://godoc.org/github.com/localhots/shezmu/caller) ### Example @@ -14,7 +14,7 @@ package main import ( "log" - "github.com/localhots/satan/caller" + "github.com/localhots/shezmu/caller" "github.com/path/to/package/messenger" ) @@ -37,7 +37,7 @@ Support code: package messenger import ( - "github.com/localhots/satan/caller" + "github.com/localhots/shezmu/caller" ) type item struct { diff --git a/daemon.go b/daemon.go index 510c10b..862d38e 100644 --- a/daemon.go +++ b/daemon.go @@ -1,4 +1,4 @@ -package satan +package shezmu import ( "errors" @@ -7,7 +7,7 @@ import ( "time" "github.com/juju/ratelimit" - "github.com/localhots/satan/caller" + "github.com/localhots/shezmu/caller" ) // Daemon is the interface that contains a set of methods required to be @@ -155,14 +155,14 @@ func (d *BaseDaemon) Continue() bool { } } -// Log logs values using satan.Logger.Println function. +// Log logs values using shezmu.Logger.Println function. func (d *BaseDaemon) Log(v ...interface{}) { if d.logger != nil { d.logger.Println(v...) } } -// Logf logs values using satan.Logger.Printf function. +// Logf logs values using shezmu.Logger.Printf function. func (d *BaseDaemon) Logf(format string, v ...interface{}) { if d.logger != nil { d.logger.Printf(format, v...) diff --git a/dashboard/package.json b/dashboard/package.json index 485b8a2..c229f47 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -1,5 +1,5 @@ { - "name": "satan", + "name": "shezmu", "private": true, "dependencies": { "react": "0.14.0", diff --git a/example/README.md b/example/README.md index bef72d1..5eee28b 100644 --- a/example/README.md +++ b/example/README.md @@ -1,3 +1,3 @@ -# Satan example application +# Shezmu example application Describe the app here. diff --git a/example/daemons/number_printer.go b/example/daemons/number_printer.go index 3a03d7e..e2da6d1 100644 --- a/example/daemons/number_printer.go +++ b/example/daemons/number_printer.go @@ -4,12 +4,12 @@ import ( "math/rand" "time" - "github.com/localhots/satan" + "github.com/localhots/shezmu" ) // NumberPrinter is a daemon that prints numbers once in a while. type NumberPrinter struct { - satan.BaseDaemon + shezmu.BaseDaemon } // Startup sets up panic handler and starts enqueuing number printing jobs. @@ -33,7 +33,7 @@ func (n *NumberPrinter) generateNumbers() { } } -func (n *NumberPrinter) makeActor(num int) satan.Actor { +func (n *NumberPrinter) makeActor(num int) shezmu.Actor { return func() { n.Log("Number printer says:", num) diff --git a/example/daemons/price_consumer.go b/example/daemons/price_consumer.go index 8f20228..9b79e17 100644 --- a/example/daemons/price_consumer.go +++ b/example/daemons/price_consumer.go @@ -3,12 +3,12 @@ package daemons import ( "time" - "github.com/localhots/satan" + "github.com/localhots/shezmu" ) // PriceConsumer consumes price update messages and prints them to the console. type PriceConsumer struct { - satan.BaseDaemon + shezmu.BaseDaemon } // PriceUpdate describes a price update message. diff --git a/example/kafka/kafka.go b/example/kafka/kafka.go index 5c5acc6..397284d 100644 --- a/example/kafka/kafka.go +++ b/example/kafka/kafka.go @@ -9,7 +9,7 @@ import ( "sync" "github.com/Shopify/sarama" - "github.com/localhots/satan" + "github.com/localhots/shezmu" ) // ConsumerState contains data that is required to create a Kafka consumer. @@ -18,10 +18,10 @@ type ConsumerState struct { Offset int64 `json:"offset"` } -// Subscriber is a dummy structure that implements satan.Subscriber interface. +// Subscriber is a dummy structure that implements shezmu.Subscriber interface. type Subscriber struct{} -// Stream is an implementation of satan.Stremer for Kafka messaging queue. +// Stream is an implementation of shezmu.Stremer for Kafka messaging queue. type Stream struct { messages chan []byte shutdown chan struct{} @@ -44,7 +44,7 @@ func Initialize(brokers []string) { defer log.Println("Kafka is initialized") conf := sarama.NewConfig() - conf.ClientID = "Satan Example" + conf.ClientID = "Shezmu Example" var err error if kafkaClient, err = sarama.NewClient(brokers, conf); err != nil { @@ -70,8 +70,8 @@ func Shutdown() { } } -// Subscribe creates a satan.Streamer implementation for Kafka messaging queue. -func (s Subscriber) Subscribe(consumer, topic string) satan.Streamer { +// Subscribe creates a shezmu.Streamer implementation for Kafka messaging queue. +func (s Subscriber) Subscribe(consumer, topic string) shezmu.Streamer { c, ok := consumers[consumer] if !ok { panic(fmt.Errorf("Consumer %q has no config", consumer)) diff --git a/example/main.go b/example/main.go index 60ecbc4..08f5f38 100644 --- a/example/main.go +++ b/example/main.go @@ -7,11 +7,11 @@ import ( "strings" "syscall" - "github.com/localhots/satan" - "github.com/localhots/satan/example/daemons" - "github.com/localhots/satan/example/kafka" - "github.com/localhots/satan/server" - "github.com/localhots/satan/stats" + "github.com/localhots/shezmu" + "github.com/localhots/shezmu/example/daemons" + "github.com/localhots/shezmu/example/kafka" + "github.com/localhots/shezmu/server" + "github.com/localhots/shezmu/stats" ) func main() { @@ -30,7 +30,7 @@ func main() { server := server.New(6464, statsServer) server.Start() - s := satan.Summon() + s := shezmu.Summon() s.Subscriber = kafka.Subscriber{} s.DaemonStats = stats.NewGroup(statsLogger, statsServer) diff --git a/server/server.go b/server/server.go index 5c17013..6b51413 100644 --- a/server/server.go +++ b/server/server.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/localhots/satan/stats" + "github.com/localhots/shezmu/stats" ) type Server struct { diff --git a/satan.go b/shezmu.go similarity index 90% rename from satan.go rename to shezmu.go index 4bed3c3..ff5942f 100644 --- a/satan.go +++ b/shezmu.go @@ -1,4 +1,4 @@ -package satan +package shezmu import ( "fmt" @@ -8,11 +8,11 @@ import ( "sync" "time" - "github.com/localhots/satan/stats" + "github.com/localhots/shezmu/stats" ) -// Satan is the master daemon. -type Satan struct { +// Shezmu is the master daemon. +type Shezmu struct { Subscriber Subscriber Publisher Publisher DaemonStats stats.Publisher @@ -71,9 +71,9 @@ const ( DefaultNumWorkers = 100 ) -// Summon creates a new instance of Satan. -func Summon() *Satan { - return &Satan{ +// Summon creates a new instance of Shezmu. +func Summon() *Shezmu { + return &Shezmu{ DaemonStats: &stats.Void{}, Logger: log.New(os.Stdout, "[daemons] ", log.LstdFlags), NumWorkers: DefaultNumWorkers, @@ -85,7 +85,7 @@ func Summon() *Satan { } // AddDaemon adds a new daemon. -func (s *Satan) AddDaemon(d Daemon) { +func (s *Shezmu) AddDaemon(d Daemon) { base := d.base() base.self = d base.subscriber = s.Subscriber @@ -99,7 +99,7 @@ func (s *Satan) AddDaemon(d Daemon) { } // StartDaemons starts all registered daemons. -func (s *Satan) StartDaemons() { +func (s *Shezmu) StartDaemons() { s.Logger.Printf("Starting %d workers", s.NumWorkers) for i := 0; i < s.NumWorkers; i++ { go s.runWorker() @@ -107,7 +107,7 @@ func (s *Satan) StartDaemons() { } // StopDaemons stops all running daemons. -func (s *Satan) StopDaemons() { +func (s *Shezmu) StopDaemons() { close(s.shutdownSystem) for _, d := range s.daemons { d.Shutdown() @@ -121,7 +121,7 @@ func (s *Satan) StopDaemons() { fmt.Println(s.runtimeStats.Fetch(stats.Latency)) } -func (s *Satan) runWorker() { +func (s *Shezmu) runWorker() { s.wgWorkers.Add(1) defer s.wgWorkers.Done() defer func() { @@ -142,7 +142,7 @@ func (s *Satan) runWorker() { } } -func (s *Satan) processTask(t *task) { +func (s *Shezmu) processTask(t *task) { dur := time.Now().Sub(t.createdAt) s.runtimeStats.Add(stats.Latency, dur) @@ -153,7 +153,7 @@ func (s *Satan) processTask(t *task) { } } -func (s *Satan) processSystemTask(t *task) { +func (s *Shezmu) processSystemTask(t *task) { // Abort starting a system task if shutdown was already called. Otherwise // incrementing a wait group counter will cause a panic. This should be an // extremely rare scenario when a system task crashes and tries to restart @@ -182,7 +182,7 @@ func (s *Satan) processSystemTask(t *task) { t.actor() // <--- ACTION STARTS HERE } -func (s *Satan) processGeneralTask(t *task) { +func (s *Shezmu) processGeneralTask(t *task) { defer func() { if err := recover(); err != nil { s.DaemonStats.Error(t.daemon.base().String()) diff --git a/submodules-to-glockfile.py b/submodules-to-glockfile.py index c507afb..43157d9 100755 --- a/submodules-to-glockfile.py +++ b/submodules-to-glockfile.py @@ -7,7 +7,7 @@ def main(): source = open(".gitmodules").read() paths = re.findall(r"path = (.*)", source) - print("github.com/localhots/satan {}".format(path_sha1("."))) + print("github.com/localhots/shezmu {}".format(path_sha1("."))) for path in paths: print("{} {}".format(path[7:], path_sha1(path)))