Skip to content

Commit 85f6643

Browse files
authored
CallFunction changes and new fields to Event interface (#14)
1 parent c5d7db4 commit 85f6643

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

event.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,15 @@ type Event interface {
121121

122122
// GetVersion returns the version of the event
123123
GetVersion() string
124+
125+
// GetLastInBatch returns whether the event is the last event in a trigger specific batch
126+
GetLastInBatch() bool
127+
128+
// GetOffset returns the offset of the event
129+
GetOffset() int
124130
}
125131

126-
// AbstractEvent provides a base implemention of an event
132+
// AbstractEvent provides a base implementation of an event
127133
type AbstractEvent struct {
128134
triggerInfoProvider TriggerInfoProvider
129135
id ID
@@ -137,7 +143,7 @@ func (ae *AbstractEvent) SetTriggerInfoProvider(triggerInfoProvider TriggerInfoP
137143
ae.triggerInfoProvider = triggerInfoProvider
138144
}
139145

140-
// GetTriggerInfo retruns a trigger info provider
146+
// GetTriggerInfo returns a trigger info provider
141147
func (ae *AbstractEvent) GetTriggerInfo() TriggerInfoProvider {
142148
return ae.triggerInfoProvider
143149
}
@@ -276,3 +282,13 @@ func (ae *AbstractEvent) GetTypeVersion() string {
276282
func (ae *AbstractEvent) GetVersion() string {
277283
return ""
278284
}
285+
286+
// GetLastInBatch returns whether the event is the last event in a trigger specific batch
287+
func (ae *AbstractEvent) GetLastInBatch() bool {
288+
return false
289+
}
290+
291+
// GetOffset returns the offset of the event
292+
func (ae *AbstractEvent) GetOffset() int {
293+
return 0
294+
}

memoryevent.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ func (me *MemoryEvent) GetMethod() string {
1313
if me.Method == "" {
1414
if len(me.Body) == 0 {
1515
return "GET"
16-
} else {
17-
return "POST"
1816
}
17+
return "POST"
1918
}
2019
return me.Method
2120
}

platform.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ func (p *Platform) CallFunction(functionName string, event Event) (Response, err
5656
}
5757

5858
func (p *Platform) getFunctionHost(name string) string {
59+
var functionHost string
60+
5961
if p.kind == "local" {
60-
return fmt.Sprintf("%s-%s:8080", p.namespace, name)
62+
functionHost = fmt.Sprintf("nuclio-%s-%s", p.namespace, name)
63+
} else {
64+
functionHost = fmt.Sprintf("nuclio-%s", name)
6165
}
62-
return fmt.Sprintf("%s:8080", name)
66+
67+
return fmt.Sprintf("%s:8080", functionHost)
6368
}
6469

6570
func (p *Platform) createRequest(functionName string, event Event) *fasthttp.Request {

0 commit comments

Comments
 (0)