blob: c62b9e4efb0763a873cc65450ee7fdb9cbecae87 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The app package contains the struct that keeps per javascript app state and handles translating
// javascript requests to vanadium requests and vice versa.
package app
import (
"time"
"v.io/v23/security"
"v.io/v23/vtrace"
"v.io/x/ref/services/wspr/internal/principal"
"v.io/x/ref/services/wspr/internal/rpc/server"
)
type RpcRequest struct {
Name string
Method string
NumInArgs int32
NumOutArgs int32
IsStreaming bool
Deadline time.WireDeadline
TraceRequest vtrace.Request
Context server.Context
CallOptions []RpcCallOption
}
// TODO(nlacasse): It would be nice if RpcCallOption and RpcServerOption
// were a struct with optional types, like:
//
// type RpcCallOptions struct {
// AllowedServersPolicy ?[]security.BlessingPattern
// RetryTimeout ?time.Duration
// }
//
// Unfortunately, optional types are currently only supported for structs, not
// slices or primitive types. Once optional types are better supported, switch
// this to a struct with optional types.
// Waiting for v.io/i/213
type RpcCallOption union {
AllowedServersPolicy []security.BlessingPattern
RetryTimeout time.Duration
Granter GranterHandle
}
type RpcServerOption union {
IsLeaf bool
ServesMountTable bool
}
type RpcResponse struct {
OutArgs []any
TraceResponse vtrace.Response
}
type GranterHandle int32
type GranterRequest struct {
GranterHandle GranterHandle
Call server.SecurityCall
}
type GranterResponse struct {
Blessings principal.BlessingsHandle
Err error
}