org.conqat.lib.commons.test.IndexValueClass Maven / Gradle / Ivy
Show all versions of teamscale-lib-commons Show documentation
package org.conqat.lib.commons.test;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.atteo.classindex.IndexAnnotated;
/**
* Indicates that this class is used as value in an index. This includes classes that are directly
* serialized in the index and classes that are serialized as part of other classes.
*
* That means we have to be careful with changes to the class. More precise, we need to ensure that
* class instances that were serialized (and stored) before the change can still be deserialized
* after the change. For example, changing the name of a field would be a problem.
*
* To find out which index can store this class in its values, have a look at the
* traces in the output ({@link System#out}) of
* {@link com.teamscale.index.index_annotations.IndexValueAnnotationTest}. If the test fails, that
* output is even visible online in the test results.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@IndexAnnotated
public @interface IndexValueClass {
/**
* If the index that contains this value is contained in backups of the Teamscale Instance, we need
* a storage migration to do changes that are not compatible with serialization/deserialization. And
* we can do migrations only on Teamscale versions that are not released to the public yet.
*
* If the index is not part of our backups, have more freedom in changing the class, but we still
* need to consider that old values (that were stored before the change) may be deserialized. For
* example, if a service reads values stored for older commits in an instance where the operator did
* a drop-in update with a patch release.
*/
boolean containedInBackup() default false;
}