public _Agent( PrivateKey privateKey, string path, IEnumerable <Peer> peers, IEnumerable <IceServer> iceServers, string host, int?port) { Debug.Log(path); var policy = GetPolicy(); PrivateKey = privateKey; Address = privateKey.PublicKey.ToAddress(); _store = new LiteDBStore($"{path}.ldb", flush: false); _blocks = new BlockChain <PolymorphicAction <ActionBase> >(policy, _store); _swarm = new Swarm <PolymorphicAction <ActionBase> >( _blocks, privateKey, appProtocolVersion: 1, millisecondsDialTimeout: SwarmDialTimeout, millisecondsLinger: SwarmLinger, host: host, listenPort: port, iceServers: iceServers, differentVersionPeerEncountered: DifferentAppProtocolVersionPeerEncountered); _seedPeers = peers.Where(peer => peer.PublicKey != privateKey.PublicKey).ToImmutableList(); // Init SyncSucceed SyncSucceed = true; // FIXME: Trusted peers should be configurable _trustedPeers = _seedPeers.Select(peer => peer.Address).ToImmutableHashSet(); _cancellationTokenSource = new CancellationTokenSource(); }
public LiteDBStoreFixture() { string postfix = Guid.NewGuid().ToString(); Path = System.IO.Path.Combine( System.IO.Path.GetTempPath(), $"litedb_{postfix}.db"); Store = new LiteDBStore(Path); }
public LiteDBStoreFixture(bool memory = false) { string postfix = Guid.NewGuid().ToString(); Path = memory ? null : System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"litedb_{postfix}.db"); Store = new LiteDBStore(Path); }
public MusicService(LiteDBStore dataStore, CoreEvents events) { songCollection = dataStore.SongCollection; events.DailyEvent += CleanOldSongs; events.InitializationDone += CleanOldSongs; }