Services

The services module implements the RPC service layer for remote computation and the local in-process server.

Overview

FusionSC has first-class support for remote execution. Calculation and data handling requests can be delegated to a remote instance. The connection is established through a fast asynchronous RPC protocol based on HTTP and WebSocket, built on Cap’n’Proto.

API Reference

namespace fsc

The FSC library.

Simple interface module for ZLib

Functions

Own<RootService::Server> createRoot(LocalConfig::Reader config)
Own<LocalResources::Server> createLocalResources(LocalConfig::Reader config)
kj::ArrayPtr<uint64_t> protectedInterfaces()

List of interface IDs that may not be called via network callss.

namespace fsc

The FSC library.

Simple interface module for ZLib

Typedefs

using Library = Own<const LibraryHandle>
using LibraryThread = Own<ThreadContext>

Functions

inline Library newLibrary(StartupParameters params = StartupParameters())
inline ThreadContext &getActiveThread()
inline bool hasActiveThread()
struct LibraryHandle : public kj::AtomicRefcounted

“Global” libary handle. This class serves as the dependency injection context for objects that should be shared across all threads. Currently, this is only the local data store table and a shared daemon runner.

Public Functions

LibraryHandle(StartupParameters params = StartupParameters())
~LibraryHandle()
inline kj::Own<const LibraryHandle> addRef() const
inline DataStore &store() const
const kj::Executor &worker() const
inline LibraryThread newThread(Maybe<kj::EventPort&> eventPort = nullptr) const
std::unique_ptr<Botan::HashFunction> defaultHash() const

Private Functions

void runSteward()

Executes the steward thread.

Private Members

mutable DataStore sharedStore
internal::LightWorkerPool workerPool

Private Static Functions

static DataStore createStoreFromSettings(StartupParameters &params)

Friends

friend class StewardContext
friend Own<LibraryHandle> atomicRefcounted()
struct NullErrorHandler : public kj::TaskSet::ErrorHandler

Public Functions

void taskFailed(kj::Exception &&e) override

Public Static Attributes

static NullErrorHandler instance
struct StartupParameters

Public Members

Maybe<DataStore> dataStore
size_t numWorkerThreads = 0
struct ThreadContext

Subclassed by fsc::WorkerContext

Public Functions

ThreadContext(Library lh, Maybe<kj::EventPort&> = nullptr)
~ThreadContext()
inline const kj::Executor &executor() const

Access to executor from outside threads.

inline const Library &library() const
inline LocalDataService &dataService()
inline kj::AsyncIoContext &ioContext()
inline kj::WaitScope &waitScope()
inline kj::Timer &timer()
inline CSPRNG &rng()
inline kj::Network &network()
inline StreamConverter &streamConverter()
inline kj::Filesystem &filesystem()
inline DataStore &store() const
inline const kj::Executor &worker() const
inline kj::Array<const byte> randomID()
template<typename T>
Promise<T> uncancelable(Promise<T> p)
Promise<void> uncancelable(Promise<void> p)
void detach(Promise<void> p)
Promise<void> drain()
kj::Canceler &lifetimeScope()

Protected Attributes

kj::TaskSet detachedTasks

Private Functions

OneOf<kj::AsyncIoContext, CustomEventPort> makeAsyncInfrastructure(Maybe<kj::EventPort&> port)

Private Members

Library _library
OneOf<kj::AsyncIoContext, CustomEventPort> asyncInfrastructure
CSPRNG _rng
Own<kj::Filesystem> _filesystem
Own<StreamConverter> _streamConverter
const kj::Executor &_executor
Own<LocalDataService> _dataService
kj::Canceler scopeProvider

Private Static Attributes

static thread_local ThreadContext *current = nullptr

Friends

friend ThreadContext &getActiveThread()
friend bool hasActiveThread()
struct CustomEventPort

Public Functions

CustomEventPort(kj::EventPort &port)

Public Members

Own<kj::EventLoop> loop
Own<kj::WaitScope> waitScope
struct WorkerContext : public fsc::ThreadContext

Thread context that cancels all long-running tasks.

Public Functions

WorkerContext(Library l)
~WorkerContext()
namespace fsc

The FSC library.

Simple interface module for ZLib

struct InProcessServer

Public Functions

virtual LocalVatHub getHub() const = 0
virtual Own<const InProcessServer> addRef() const = 0
template<typename T>
inline T::Client connect() const
inline capnp::Capability::Client connectBase() const
namespace fsc

The FSC library.

Simple interface module for ZLib