io.permazen.jsck.ComplexFieldIndex Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of permazen-jsck Show documentation
Show all versions of permazen-jsck Show documentation
Permazen analog to UNIX fsck(8) command for checking the consistency of, and repairing any corruption in, a Permazen key/value database
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package io.permazen.jsck;
import io.permazen.schema.ComplexSchemaField;
import io.permazen.schema.SimpleSchemaField;
abstract class ComplexFieldIndex extends SimpleIndex {
protected final int parentStorageId;
protected final String subFieldName;
protected final String parentFieldName;
protected ComplexFieldIndex(JsckInfo info, int schemaVersion,
ComplexSchemaField field, SimpleSchemaField subField, String parentFieldName, String subFieldName) {
super(info, schemaVersion, subField);
this.parentStorageId = field.getStorageId();
this.parentFieldName = parentFieldName;
this.subFieldName = subFieldName;
assert this.parentStorageId > 0;
}
@Override
public boolean isCompatible(Storage that) {
if (!super.isCompatible(that))
return false;
if (this.parentStorageId != ((ComplexFieldIndex)that).parentStorageId)
return false;
return true;
}
// Object
@Override
public final String toString() {
return "index on " + this.subFieldName + " field #" + this.storageId
+ " (" + this.type + ") of " + this.parentFieldName + " field #" + this.parentStorageId;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy