private async Task MarkFreeSpaceAsync(SqoTypeInfo ti) { ObjectSerializer serializer = SerializerFactory.GetSerializer(this.path, GetFileByType(ti), useElevatedTrust); int nrRecords = ti.Header.numberOfRecords; List <FieldSqoInfo> existingDynamicFields = new List <FieldSqoInfo>(); foreach (FieldSqoInfo ai in ti.Fields) { IByteTransformer byteTrans = ByteTransformerFactory.GetByteTransformer(null, null, ai, ti); if (byteTrans is ArrayByteTranformer || byteTrans is DictionaryByteTransformer) { existingDynamicFields.Add(ai); } } if (existingDynamicFields.Count > 0) { for (int i = 0; i < nrRecords; i++) { int oid = i + 1; foreach (FieldSqoInfo ai in existingDynamicFields) { ATuple <int, int> arrayInfo = await this.GetArrayMetaOfFieldAsync(ti, oid, ai).ConfigureAwait(false); if (arrayInfo.Name > 0) { await rawSerializer.MarkRawInfoAsFreeAsync(arrayInfo.Name).ConfigureAwait(false);//this helps Shrink method to detect unused rawdata blocks. } } } } }
private void MarkObjectAsDelete(ObjectSerializer serializer, int oid, SqoTypeInfo ti) { foreach (FieldSqoInfo ai in ti.Fields) { IByteTransformer byteTrans = ByteTransformerFactory.GetByteTransformer(null, null, ai, ti); if (byteTrans is ArrayByteTranformer || byteTrans is DictionaryByteTransformer) { ATuple <int, int> arrayInfo = this.GetArrayMetaOfField(ti, oid, ai); if (arrayInfo.Name > 0) { rawSerializer.MarkRawInfoAsFree(arrayInfo.Name);//this helps Shrink method to detect unused rawdata blocks. } } } serializer.MarkObjectAsDelete(oid, ti); }
private async Task MarkObjectAsDeleteAsync(ObjectSerializer serializer, int oid, SqoTypeInfo ti) { foreach (FieldSqoInfo ai in ti.Fields) { IByteTransformer byteTrans = ByteTransformerFactory.GetByteTransformer(null, null, ai, ti); if (byteTrans is ArrayByteTranformer || byteTrans is DictionaryByteTransformer) { ATuple <int, int> arrayInfo = await this.GetArrayMetaOfFieldAsync(ti, oid, ai).ConfigureAwait(false); if (arrayInfo.Name > 0) { await rawSerializer.MarkRawInfoAsFreeAsync(arrayInfo.Name).ConfigureAwait(false);//this helps Shrink method to detect unused rawdata blocks. } } } await serializer.MarkObjectAsDeleteAsync(oid, ti).ConfigureAwait(false); }