Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function createRemoteCausalRepoPartition(
config: PartitionConfig,
user: User
): Promise {
if (config.type === 'remote_causal_repo') {
const manager = new SocketManager(config.host);
manager.init();
const connection = new SocketIOConnectionClient(manager.socket, user);
const client = new CausalRepoClient(connection);
const partition = new RemoteCausalRepoPartitionImpl(
user,
client,
config
);
await partition.init();
return partition;
}
return undefined;
}
export async function createRemoteCausalRepoPartition(
config: PartitionConfig,
user: User
): Promise {
if (config.type === 'remote_causal_repo') {
const manager = new SocketManager(config.host);
manager.init();
const connection = new SocketIOConnectionClient(manager.socket, user);
const client = new CausalRepoClient(connection);
const partition = new RemoteCausalRepoPartitionImpl(
user,
client,
config
);
await partition.init();
return partition;
}
return undefined;
}
options: RemoteCausalTreePartitionOptions,
user: User,
config: RemoteCausalTreePartitionConfig
) {
this._treeName = config.treeName;
this._user = user;
this._treeOptions = options.treeOptions || {};
let url = new URL(options.defaultHost);
this._socketManager = new SocketManager(
config.host
? `${url.protocol}//${config.host}`
: options.defaultHost
);
this._treeManager = new CausalTreeManager(
this._socketManager,
auxCausalTreeFactory(),
options.store,
options.crypto
);
}
constructor(defaultHost: string, config: AuxConfig) {
this._config = config;
this._subs = [];
let url = new URL(defaultHost);
this._socketManager = new SocketManager(
config.host ? `${url.protocol}//${config.host}` : defaultHost
);
this._treeManager = new CausalTreeManager(
this._socketManager.socket,
auxCausalTreeFactory(),
new NullCausalTreeStore()
);
}
constructor(
options: RemoteCausalTreePartitionOptions,
user: User,
config: RemoteCausalTreePartitionConfig
) {
this._treeName = config.treeName;
this._user = user;
this._treeOptions = options.treeOptions || {};
let url = new URL(options.defaultHost);
this._socketManager = new SocketManager(
config.host
? `${url.protocol}//${config.host}`
: options.defaultHost
);
this._treeManager = new CausalTreeManager(
this._socketManager,
auxCausalTreeFactory(),
options.store,
options.crypto
);
}