1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use bytes::Bytes;

/// Contains information about the call to the user function
pub struct Event {
    /// The data passed to the user function in the request
    pub data: Option<Bytes>,

    /// TODO document
    pub event_id: String,

    /// TODO document
    pub event_type: String,

    /// TODO document
    pub event_time: String,

    /// TODO document
    pub event_namespace: String,
}

/// Contains information about the environment
pub struct Context {
    pub function_name: String,
    pub runtime: String,
    pub timeout: usize,
    pub memory_limit: usize,
}

/// A function callable from kubeless
pub type UserFunction = fn(event: Event, context: Context) -> String;