Package com.taobao.metamorphosis.server.store

Examples of com.taobao.metamorphosis.server.store.MessageStore.slice()


        final int opaque = 0;
        final int maxSize = 1024;
        final long offset = 10;
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(null);
        this.conn.response(new BooleanCommand(HttpStatus.NotFound, "Could not find message at position "
                + offset, opaque));
        EasyMock.expect(store.getMaxOffset()).andReturn(offset);
        EasyMock.expectLastCall();
        this.mocksControl.replay();
View Full Code Here


        final int opaque = 0;
        final int maxSize = 1024;
        final long offset = 10;
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(null);
        this.conn.response(new BooleanCommand(HttpStatus.NotFound, "Could not find message at position "
                + offset, opaque));
        EasyMock.expect(store.getMaxOffset()).andReturn(offset - 1);
        EasyMock.expectLastCall();
        this.mocksControl.replay();
View Full Code Here

        final int maxSize = 1024;
        final long offset = Long.MAX_VALUE;
        final long realMaxOffset = 100;
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(null);
        this.conn.response(new BooleanCommand(HttpStatus.Moved, String.valueOf(realMaxOffset), opaque));
        EasyMock.expect(store.getMaxOffset()).andReturn(realMaxOffset);
        EasyMock.expectLastCall();
        this.mocksControl.replay();
View Full Code Here

        final int maxSize = 1024;
        final long offset = 10;
        final long newOffset = 512;
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        EasyMock.expect(store.slice(offset, maxSize)).andThrow(new ArrayIndexOutOfBoundsException());
        EasyMock.expect(store.getNearestOffset(offset)).andReturn(newOffset);
        this.conn.response(new BooleanCommand(HttpStatus.Moved, String.valueOf(newOffset), opaque));
        EasyMock.expectLastCall();
        this.mocksControl.replay();
View Full Code Here

        final int maxSize = 1024;
        final long offset = 10;
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        final MessageSet set = this.mocksControl.createMock(MessageSet.class);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(set);
        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        set.write(request, this.sessionContext);
        EasyMock.expectLastCall();
        this.mocksControl.replay();
View Full Code Here

                MessageUtils.makeMessageBuffer(999, new PutCommand(this.topic, partition, "hello world".getBytes(),
                    null, 0, opaque));
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        final MessageSet set = this.mocksControl.createMock(MessageSet.class);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(set);
        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        set.read((ByteBuffer) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Void>() {

            @Override
View Full Code Here

                MessageUtils.makeMessageBuffer(999, new PutCommand(this.topic, partition, "hello world".getBytes(),
                    null, 0, opaque));
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        final MessageSet set = this.mocksControl.createMock(MessageSet.class);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(set);
        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        set.read((ByteBuffer) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Void>() {

            @Override
View Full Code Here

            return new BooleanCommand(HttpStatus.BadRequest, "Bad request,invalid max size:" + request.getMaxSize(),
                request.getOpaque());
        }
        try {
            final MessageSet set =
                    store.slice(request.getOffset(),
                        Math.min(this.metaConfig.getMaxTransferSize(), request.getMaxSize()));
            ConsumerMessageFilter filter = this.consumerFilterManager.findFilter(topic, group);
            if (set != null) {
                if (zeroCopy && filter == null) {
                    set.write(request, ctx);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.