Skip to content

Commit

Permalink
Rename app to ackbar
Browse files Browse the repository at this point in the history
  • Loading branch information
mkretz committed May 29, 2024
1 parent 3d76d6f commit e310709
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 24 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# lando
# ackbar

A microservice for coordinating stateful workload on partitions of data
4 changes: 2 additions & 2 deletions cmd/example/k8s/deploy-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ spec:
spec:
containers:
- name: example-client
image: bespinian/ackbar-example-client:0.0.1
image: bespinian/ackbar-example-client:0.0.2
imagePullPolicy: Always
env:
- name: LANDO_URL
- name: ACKBAR_URL
value: http://ackbar.ackbar
- name: CONTEXT_ID
value: f3327714-8d22-44ae-b9c1-840544b398b4
6 changes: 3 additions & 3 deletions cmd/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import (
)

func main() {
landoUrl := os.Getenv("LANDO_URL")
ackbarUrl := os.Getenv("ACKBAR_URL")
contextId := os.Getenv("CONTEXT_ID")

log.Printf("Starting worker in context %s", contextId)

workersUrl := fmt.Sprintf("%s/contexts/%s/workers", landoUrl, contextId)
workersUrl := fmt.Sprintf("%s/contexts/%s/workers", ackbarUrl, contextId)

log.Printf("Registering worker at %s", workersUrl)
res, err := http.Post(workersUrl, "Content-Type:application/json", strings.NewReader(""))
if err != nil {
log.Fatalf("Failed registering worker: %e", err)
}

workerUrl := fmt.Sprintf("%s%s", landoUrl, res.Header.Get(headers.Location))
workerUrl := fmt.Sprintf("%s%s", ackbarUrl, res.Header.Get(headers.Location))
log.Printf("Refresh URL is %s", workerUrl)

log.Printf("Starting processing")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/bespinian/lando
module github.com/bespinian/ackbar

go 1.19

Expand Down
12 changes: 7 additions & 5 deletions internal/api/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import (
"log"
"net/http"

"github.com/bespinian/lando/internal/model"
"github.com/bespinian/ackbar/internal/model"
"github.com/gin-gonic/gin"
"github.com/go-http-utils/headers"
"github.com/google/uuid"
)

var RootPath = "/"
var ContextsPath = fmt.Sprintf("%s%s", RootPath, "contexts")
var ContextIdPlaceholder = ":contextId"
var ContextPath = fmt.Sprintf("%s/%s", ContextsPath, ContextIdPlaceholder)
var (
RootPath = "/"
ContextsPath = fmt.Sprintf("%s%s", RootPath, "contexts")
ContextIdPlaceholder = ":contextId"
ContextPath = fmt.Sprintf("%s/%s", ContextsPath, ContextIdPlaceholder)
)

func (a *Api) GetContexts(c *gin.Context) {
contexts, _ := a.Backend.GetContexts()
Expand Down
6 changes: 3 additions & 3 deletions internal/api/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"
"strings"

"github.com/bespinian/lando/internal/backend"
"github.com/bespinian/lando/internal/model"
"github.com/bespinian/ackbar/internal/backend"
"github.com/bespinian/ackbar/internal/model"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
)
Expand All @@ -14,7 +14,7 @@ type Api struct {
Backend backend.Backend
}

var version = model.Info{Name: "lando", Version: "0.0.1"}
var version = model.Info{Name: "ackbar", Version: "0.0.1"}

func (a *Api) GetInfo(c *gin.Context) {
c.IndentedJSON(http.StatusOK, version)
Expand Down
10 changes: 6 additions & 4 deletions internal/api/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import (
"log"
"net/http"

"github.com/bespinian/lando/internal/model"
"github.com/bespinian/ackbar/internal/model"
"github.com/gin-gonic/gin"
"github.com/go-http-utils/headers"
"github.com/google/uuid"
)

var PartitionsPath = fmt.Sprintf("%s/%s", ContextPath, "partitions")
var PartitionIdPlaceholder = ":partitionId"
var PartitionPath = fmt.Sprintf("%s/%s", PartitionsPath, PartitionIdPlaceholder)
var (
PartitionsPath = fmt.Sprintf("%s/%s", ContextPath, "partitions")
PartitionIdPlaceholder = ":partitionId"
PartitionPath = fmt.Sprintf("%s/%s", PartitionsPath, PartitionIdPlaceholder)
)

func (a *Api) GetPartitions(c *gin.Context) {
contextId := c.Param("contextId")
Expand Down
2 changes: 1 addition & 1 deletion internal/backend/interface.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package backend

import (
"github.com/bespinian/lando/internal/model"
"github.com/bespinian/ackbar/internal/model"
"github.com/google/uuid"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/backend/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/bespinian/lando/internal/model"
"github.com/bespinian/ackbar/internal/model"
"github.com/google/uuid"
redis "github.com/redis/go-redis/v9"
)
Expand Down
2 changes: 1 addition & 1 deletion k8s/deploy-ackbar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: ackbar
image: bespinian/ackbar:0.0.3
image: bespinian/ackbar:0.0.4
imagePullPolicy: Always
ports:
- containerPort: 8080
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"log"
"os"

apimodule "github.com/bespinian/lando/internal/api"
"github.com/bespinian/lando/internal/backend"
apimodule "github.com/bespinian/ackbar/internal/api"
"github.com/bespinian/ackbar/internal/backend"
"github.com/gin-gonic/gin"
)

Expand Down

0 comments on commit e310709

Please sign in to comment.