mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
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.
45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
package models
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
)
|
|
|
|
type LogStore interface {
|
|
// InsertLog will insert the log at callID, overwriting if it previously
|
|
// existed.
|
|
InsertLog(ctx context.Context, call *Call, callLog io.Reader) error
|
|
|
|
// GetLog will return the log at callID, an error will be returned if the log
|
|
// cannot be found.
|
|
GetLog(ctx context.Context, fnID, callID string) (io.Reader, error)
|
|
|
|
// TODO we should probably allow deletion of a range of logs (also calls)?
|
|
// common cases for deletion will be:
|
|
// * route gets nuked
|
|
// * app gets nuked
|
|
// * call+logs getting cleaned up periodically
|
|
|
|
// InsertCall inserts a call into the datastore, it will error if the call already
|
|
// exists.
|
|
InsertCall(ctx context.Context, call *Call) error
|
|
|
|
// GetCall returns a call at a certain id and app name.
|
|
GetCall1(ctx context.Context, appId, callID string) (*Call, error)
|
|
|
|
// GetCall2 returns a call at a certain id
|
|
GetCall(ctx context.Context, fnID, callID string) (*Call, error)
|
|
|
|
// GetCalls returns a list of calls that satisfy the given CallFilter. If no
|
|
// calls exist, an empty list and a nil error are returned.
|
|
GetCalls1(ctx context.Context, filter *CallFilter) ([]*Call, error)
|
|
|
|
// GetCalls returns a list of calls that satisfy the given CallFilter. If no
|
|
// calls exist, an empty list and a nil error are returned.
|
|
GetCalls(ctx context.Context, filter *CallFilter) (*CallList, error)
|
|
|
|
// Close will close any underlying connections as needed.
|
|
// Close is not safe to be called from multiple threads.
|
|
io.Closer
|
|
}
|