function prefix

This commit is contained in:
Asim Aslam
2021-12-10 16:13:53 +00:00
parent 52a11c0872
commit 94d3ace6cb
2 changed files with 6 additions and 8 deletions

View File

@@ -3,5 +3,3 @@ Serverless compute as a service
# Function Service # Function Service
Deploy and run serverless functions for any project from a Git repository. Deploy and run serverless functions for any project from a Git repository.

View File

@@ -142,7 +142,7 @@ func (e *Function) Deploy(ctx context.Context, req *function.DeployRequest, rsp
project = "default" project = "default"
} }
key := fmt.Sprintf("%s/%s/%s", tenantId, project, req.Name) key := fmt.Sprintf("function/%s/%s/%s", tenantId, project, req.Name)
records, err := store.Read(key) records, err := store.Read(key)
if err != nil && err != store.ErrNotFound { if err != nil && err != store.ErrNotFound {
@@ -156,7 +156,7 @@ func (e *Function) Deploy(ctx context.Context, req *function.DeployRequest, rsp
// check for function limit // check for function limit
if e.limit > 0 { if e.limit > 0 {
// read all the records for the user // read all the records for the user
records, err := store.Read(tenantId+"/", store.ReadPrefix()) records, err := store.Read("function/"+tenantId+"/", store.ReadPrefix())
if err != nil { if err != nil {
return err return err
} }
@@ -238,7 +238,7 @@ func (e *Function) Update(ctx context.Context, req *function.UpdateRequest, rsp
project = "default" project = "default"
} }
key := fmt.Sprintf("%s/%s/%s", tenantId, project, req.Name) key := fmt.Sprintf("function/%s/%s/%s", tenantId, project, req.Name)
records, err := store.Read(key) records, err := store.Read(key)
if err != nil { if err != nil {
@@ -379,7 +379,7 @@ func (e *Function) Delete(ctx context.Context, req *function.DeleteRequest, rsp
return err return err
} }
key := fmt.Sprintf("%v/%v/%v", tenantId, project, req.Name) key := fmt.Sprintf("function/%v/%v/%v", tenantId, project, req.Name)
return store.Delete(key) return store.Delete(key)
} }
@@ -392,7 +392,7 @@ func (e *Function) List(ctx context.Context, req *function.ListRequest, rsp *fun
tenantId = "micro" tenantId = "micro"
} }
key := tenantId + "/" key := "function/" + tenantId + "/"
project := req.Project project := req.Project
if len(project) > 0 { if len(project) > 0 {
@@ -452,7 +452,7 @@ func (e *Function) Describe(ctx context.Context, req *function.DescribeRequest,
} }
multitenantPrefix := strings.Replace(tenantId, "/", "-", -1) multitenantPrefix := strings.Replace(tenantId, "/", "-", -1)
key := fmt.Sprintf("%v/%v/%v", tenantId, project, req.Name) key := fmt.Sprintf("function/%v/%v/%v", tenantId, project, req.Name)
records, err := store.Read(key) records, err := store.Read(key)
if err != nil { if err != nil {