diff --git a/event.go b/event.go index f09e38a..1db287e 100644 --- a/event.go +++ b/event.go @@ -121,9 +121,15 @@ type Event interface { // GetVersion returns the version of the event GetVersion() string + + // GetLastInBatch returns whether the event is the last event in a trigger specific batch + GetLastInBatch() bool + + // GetOffset returns the offset of the event + GetOffset() int } -// AbstractEvent provides a base implemention of an event +// AbstractEvent provides a base implementation of an event type AbstractEvent struct { triggerInfoProvider TriggerInfoProvider id ID @@ -137,7 +143,7 @@ func (ae *AbstractEvent) SetTriggerInfoProvider(triggerInfoProvider TriggerInfoP ae.triggerInfoProvider = triggerInfoProvider } -// GetTriggerInfo retruns a trigger info provider +// GetTriggerInfo returns a trigger info provider func (ae *AbstractEvent) GetTriggerInfo() TriggerInfoProvider { return ae.triggerInfoProvider } @@ -276,3 +282,13 @@ func (ae *AbstractEvent) GetTypeVersion() string { func (ae *AbstractEvent) GetVersion() string { return "" } + +// GetLastInBatch returns whether the event is the last event in a trigger specific batch +func (ae *AbstractEvent) GetLastInBatch() bool { + return false +} + +// GetOffset returns the offset of the event +func (ae *AbstractEvent) GetOffset() int { + return 0 +} diff --git a/memoryevent.go b/memoryevent.go index 893577d..d61fbbe 100644 --- a/memoryevent.go +++ b/memoryevent.go @@ -13,9 +13,8 @@ func (me *MemoryEvent) GetMethod() string { if me.Method == "" { if len(me.Body) == 0 { return "GET" - } else { - return "POST" } + return "POST" } return me.Method } diff --git a/platform.go b/platform.go index 44c2b9b..09a1476 100644 --- a/platform.go +++ b/platform.go @@ -56,10 +56,15 @@ func (p *Platform) CallFunction(functionName string, event Event) (Response, err } func (p *Platform) getFunctionHost(name string) string { + var functionHost string + if p.kind == "local" { - return fmt.Sprintf("%s-%s:8080", p.namespace, name) + functionHost = fmt.Sprintf("nuclio-%s-%s", p.namespace, name) + } else { + functionHost = fmt.Sprintf("nuclio-%s", name) } - return fmt.Sprintf("%s:8080", name) + + return fmt.Sprintf("%s:8080", functionHost) } func (p *Platform) createRequest(functionName string, event Event) *fasthttp.Request {