Search in sources :

Example 1 with OffloadContext

use of org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadContext in project pulsar by yahoo.

the class OffloadUtils method getOffloadDriverMetadata.

public static Map<String, String> getOffloadDriverMetadata(LedgerInfo ledgerInfo, Map<String, String> defaultOffloadDriverMetadata) {
    if (ledgerInfo.hasOffloadContext()) {
        OffloadContext ctx = ledgerInfo.getOffloadContext();
        if (ctx.hasDriverMetadata()) {
            OffloadDriverMetadata driverMetadata = ctx.getDriverMetadata();
            if (driverMetadata.getPropertiesCount() > 0) {
                Map<String, String> metadata = Maps.newHashMap();
                driverMetadata.getPropertiesList().forEach(kv -> metadata.put(kv.getKey(), kv.getValue()));
                return metadata;
            }
        }
    }
    return defaultOffloadDriverMetadata;
}
Also used : ByteString(com.google.protobuf.ByteString) OffloadContext(org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadContext) OffloadDriverMetadata(org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadDriverMetadata)

Example 2 with OffloadContext

use of org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadContext in project incubator-pulsar by apache.

the class OffloadUtils method getOffloadDriverMetadata.

public static Map<String, String> getOffloadDriverMetadata(LedgerInfo ledgerInfo, Map<String, String> defaultOffloadDriverMetadata) {
    if (ledgerInfo.hasOffloadContext()) {
        OffloadContext ctx = ledgerInfo.getOffloadContext();
        if (ctx.hasDriverMetadata()) {
            OffloadDriverMetadata driverMetadata = ctx.getDriverMetadata();
            if (driverMetadata.getPropertiesCount() > 0) {
                Map<String, String> metadata = Maps.newHashMap();
                driverMetadata.getPropertiesList().forEach(kv -> metadata.put(kv.getKey(), kv.getValue()));
                return metadata;
            }
        }
    }
    return defaultOffloadDriverMetadata;
}
Also used : ByteString(com.google.protobuf.ByteString) OffloadContext(org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadContext) OffloadDriverMetadata(org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadDriverMetadata)

Example 3 with OffloadContext

use of org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadContext in project pulsar by apache.

the class OffloadUtils method getOffloadDriverMetadata.

public static Map<String, String> getOffloadDriverMetadata(LedgerInfo ledgerInfo, Map<String, String> defaultOffloadDriverMetadata) {
    if (ledgerInfo.hasOffloadContext()) {
        OffloadContext ctx = ledgerInfo.getOffloadContext();
        if (ctx.hasDriverMetadata()) {
            OffloadDriverMetadata driverMetadata = ctx.getDriverMetadata();
            if (driverMetadata.getPropertiesCount() > 0) {
                Map<String, String> metadata = Maps.newHashMap();
                driverMetadata.getPropertiesList().forEach(kv -> metadata.put(kv.getKey(), kv.getValue()));
                return metadata;
            }
        }
    }
    return defaultOffloadDriverMetadata;
}
Also used : ByteString(com.google.protobuf.ByteString) OffloadContext(org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadContext) OffloadDriverMetadata(org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadDriverMetadata)

Aggregations

ByteString (com.google.protobuf.ByteString)3 OffloadContext (org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadContext)3 OffloadDriverMetadata (org.apache.bookkeeper.mledger.proto.MLDataFormats.OffloadDriverMetadata)3