Search in sources :

Example 36 with IcebergTable

use of org.projectnessie.model.IcebergTable in project nessie by projectnessie.

the class TableCommitMetaStoreWorker method toStoreGlobalState.

@Override
public ByteString toStoreGlobalState(Content content) {
    ObjectTypes.Content.Builder builder = ObjectTypes.Content.newBuilder().setId(content.getId());
    if (content instanceof IcebergTable) {
        IcebergTable state = (IcebergTable) content;
        ObjectTypes.IcebergMetadataPointer.Builder stateBuilder = ObjectTypes.IcebergMetadataPointer.newBuilder().setMetadataLocation(state.getMetadataLocation());
        builder.setIcebergMetadataPointer(stateBuilder);
    } else if (content instanceof IcebergView) {
        IcebergView state = (IcebergView) content;
        ObjectTypes.IcebergMetadataPointer.Builder stateBuilder = ObjectTypes.IcebergMetadataPointer.newBuilder().setMetadataLocation(state.getMetadataLocation());
        builder.setIcebergMetadataPointer(stateBuilder);
    } else {
        throw new IllegalArgumentException("Unknown type " + content);
    }
    return builder.build().toByteString();
}
Also used : Content(org.projectnessie.model.Content) Builder(org.projectnessie.model.ImmutableDeltaLakeTable.Builder) ImmutableIcebergTable(org.projectnessie.model.ImmutableIcebergTable) IcebergTable(org.projectnessie.model.IcebergTable) ImmutableIcebergView(org.projectnessie.model.ImmutableIcebergView) IcebergView(org.projectnessie.model.IcebergView) ObjectTypes(org.projectnessie.store.ObjectTypes)

Aggregations

IcebergTable (org.projectnessie.model.IcebergTable)36 Branch (org.projectnessie.model.Branch)25 Test (org.junit.jupiter.api.Test)22 ContentKey (org.projectnessie.model.ContentKey)18 Content (org.projectnessie.model.Content)12 CommitMeta (org.projectnessie.model.CommitMeta)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 LogEntry (org.projectnessie.model.LogResponse.LogEntry)8 Reference (org.projectnessie.model.Reference)8 List (java.util.List)7 Collectors (java.util.stream.Collectors)7 Tag (org.projectnessie.model.Tag)7 LogResponse (org.projectnessie.model.LogResponse)6 Map (java.util.Map)5 BaseNessieClientServerException (org.projectnessie.error.BaseNessieClientServerException)5 NessieNotFoundException (org.projectnessie.error.NessieNotFoundException)5 Put (org.projectnessie.model.Operation.Put)5 ArrayList (java.util.ArrayList)4 Stream (java.util.stream.Stream)4 CommitFailedException (org.apache.iceberg.exceptions.CommitFailedException)4