mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Copy logs up to v2 endpoints (#1207)
Copies the log endpoints up to the V2 endpoints, in a similar way to the call endpoints. The main change is to when logs are inserted into S3. The signature of the function has been changed to take the whole call object, rather than just the app and call id's. This allows the function to switch between calls for Routes and those for Fns. Obviously this switching can be removed when v1 is removed. In the sql implementation it inserts with both appID and fnID, this allows the two get's to work, and the down grade of the migration. When the v1 logs are removed, the appId can be dropped. The log fetch test and error messages have been changed to be FnID specific.
This commit is contained in:
@@ -16,14 +16,14 @@ type validator struct {
|
||||
}
|
||||
|
||||
// callID or appID will never be empty.
|
||||
func (v *validator) InsertLog(ctx context.Context, appID, callID string, callLog io.Reader) error {
|
||||
if callID == "" {
|
||||
func (v *validator) InsertLog(ctx context.Context, call *models.Call, callLog io.Reader) error {
|
||||
if call.ID == "" {
|
||||
return models.ErrDatastoreEmptyCallID
|
||||
}
|
||||
if appID == "" {
|
||||
return models.ErrMissingAppID
|
||||
if call.AppID == "" && call.FnID == "" {
|
||||
return models.ErrMissingFnID
|
||||
}
|
||||
return v.LogStore.InsertLog(ctx, appID, callID, callLog)
|
||||
return v.LogStore.InsertLog(ctx, call, callLog)
|
||||
}
|
||||
|
||||
// callID or appID will never be empty.
|
||||
@@ -32,7 +32,7 @@ func (v *validator) GetLog(ctx context.Context, appID, callID string) (io.Reader
|
||||
return nil, models.ErrDatastoreEmptyCallID
|
||||
}
|
||||
if appID == "" {
|
||||
return nil, models.ErrMissingAppID
|
||||
return nil, models.ErrMissingFnID
|
||||
}
|
||||
return v.LogStore.GetLog(ctx, appID, callID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user