Ejemplo n.º 1
0
        private async Task RunCustomTest(ContentLocationDatabaseConfiguration configuration, Action <OperationContext, ContentLocationDatabase> action, OperationContext?overwrite = null)
        {
            var tracingContext   = new Context(TestGlobal.Logger);
            var operationContext = overwrite ?? new OperationContext(tracingContext);

            var database = ContentLocationDatabase.Create(Clock, configuration, () => new MachineId[] { });
            await database.StartupAsync(operationContext).ShouldBeSuccess();

            database.SetDatabaseMode(isDatabaseWritable: true);

            action(operationContext, database);

            await database.ShutdownAsync(operationContext).ShouldBeSuccess();
        }
Ejemplo n.º 2
0
        private HashSet <StrongFingerprint> AddRandomContentHashLists(
            OperationContext context, int count, ContentLocationDatabase session)
        {
            var strongFingerprints = new HashSet <StrongFingerprint>();

            for (int i = 0; i < count; i++)
            {
                var strongFingerprint = StrongFingerprint.Random();
                var contentHashListWithDeterminism = new ContentHashListWithDeterminism(ContentHashList.Random(), CacheDeterminism.None);
                session.AddOrGetContentHashList(context, strongFingerprint, contentHashListWithDeterminism).ShouldBeSuccess();
                strongFingerprints.Add(strongFingerprint);
            }

            return(strongFingerprints);
        }
 /// <nodoc />
 public RocksDbMemoizationDatabase(ContentLocationDatabase database, bool ownsDatabase = true)
 {
     _ownsDatabase = ownsDatabase;
     Database      = database;
 }
 /// <nodoc />
 public RocksDbMemoizationDatabase(ContentLocationDatabase database, bool ownsDatabase = true)
 {
     Tracer        = new Tracer(nameof(RocksDbMemoizationDatabase));
     _ownsDatabase = ownsDatabase;
     Database      = database;
 }