private void StartDataStore(string destination, string metaDestination) { RepositoryHooks hooks = new RepositoryHooks { OnDataAllocated = OnDataAllocated, OnDataVerified = OnDataVerified, OnBlockWritten = data => DataGet?.Handle(data), OnBlockRead = data => DataShare?.Handle(data), OnPieceAccepted = data => DataGet?.Handle(data), OnPieceRejected = OnPieceRejected }; DataStore = new RepositoryBuilder() .WithHash(Hash) .WithDestination(destination) .WithMetaDestination(metaDestination) .WithPipeline(Pipeline) .WithFiles(Files) .WithMemory(Memory.AsDataStore()) .WithBufferSize(256 * 1024) .Build(hooks); DataStore.Start(); }
/// <summary> /// Default constructor. /// </summary> public HookManager() { onLoad = new Dictionary<Type, object>(); onBeforeSave = new Dictionary<Type, object>(); onAfterSave = new Dictionary<Type, object>(); onBeforeDelete = new Dictionary<Type, object>(); onAfterDelete = new Dictionary<Type, object>(); Alias = new RepositoryHooks<Data.Alias>(); Category = new RepositoryHooks<Data.Category>(); Media = new RepositoryHooks<Data.Media>(); MediaFolder = new RepositoryHooks<Data.MediaFolder>(); Param = new RepositoryHooks<Data.Param>(); Site = new RepositoryHooks<Data.Site>(); Tag = new RepositoryHooks<Data.Tag>(); }
private void StartDataStore(string destination) { RepositoryHooks hooks = new RepositoryHooks { OnDataAllocated = OnDataAllocated, OnDataVerified = OnDataVerified, OnBlockWritten = OnBlockWritten, OnPieceAccepted = OnPieceAccepted, OnPieceRejected = OnPieceRejected }; DataStore = new RepositoryBuilder() .WithHash(Hash) .WithDestination(Path.Combine(destination, Hash.ToString())) .WithPipeline(Pipeline) .WithFiles(Files) .WithMemory(Memory.AsDataStore()) .WithBufferSize(256 * 1024) .Build(hooks); DataStore.Start(); }