package com.splicemachine.async;

import org.jboss.netty.buffer.ChannelBuffer;
import java.util.List;

/**
 * @author Scott Fines
 * Date: 7/16/14
 */
public class AsyncSuccessFilter extends ScanFilter {
    private static final byte[] NAME =Bytes.ISO88591(AsyncSuccessFilter.class.getName());
    private List<byte[]> failedTasks;

    public AsyncSuccessFilter(List<byte[]> failedTasks) {
        this.failedTasks = failedTasks;
    }

    @Override byte[] name() { return NAME; }

    @Override
    byte[] serialize() {
        throw new UnsupportedOperationException("IMPLEMENT FOR 0.96+");
    }

    @Override
    void serializeOld(ChannelBuffer buf) {
        buf.writeByte((byte)NAME.length);
        buf.writeBytes(NAME);

        buf.writeInt(failedTasks.size());
        for (byte[] n : failedTasks) {
            buf.writeInt(n.length);
            buf.writeBytes(n);
        }
    }

    @Override
    int predictSerializedSize() {
        int size = 5+NAME.length;
        for(byte[] n :failedTasks){
            size+=n.length+4;
        }
        return size;
    }
}

@@ -72,16 +72,124 @@
 Buffer;%0A
+%0Aimport com.google.protobuf.ZeroCopyLiteralByteString;%0Aimport com.splicemachine.coprocessor.SpliceMessage;%0A%0A
 import j
@@ -636,69 +636,287 @@
     
-throw new UnsupportedOperationException(%22IMPLEMENT FOR 0.96+%22
+SpliceMessage.SuccessFilterMessage.Builder builder = SpliceMessage.SuccessFilterMessage.newBuilder();%0A        for(byte%5B%5D failedTask:failedTasks)%7B%0A            builder.addFailedTasks(ZeroCopyLiteralByteString.wrap(failedTask));%0A        %7D%0A        return builder.build().toByteArray(
 );%0A 

Implement message based serde