Package com.flaptor.indextank.rpc

Examples of com.flaptor.indextank.rpc.LogBatch


        throw new RuntimeException("REVERT UNIMPLEMENTED");
    }


    private LogPage endPage() {
        return new LogPage(new LogBatch(Lists.<LogRecord>newArrayList()));
    }
View Full Code Here


        long position = token.get_file_position();
       
        // get a portion reader for the current segment and the position denoted by the token
        SegmentReader reader = segment.portionReader(position, root.getReadingPageSize());
       
        LogPage page = new LogPage(new LogBatch(Lists.<LogRecord>newArrayList()));

        // iterate the portion and load the records in the returned page
        RecordIterator iterator = reader.iterator();
        while (iterator.hasNext()) {
            LogRecord next = iterator.next();
View Full Code Here

                String code = split[2];
                String text = null;
                if (split.length > 3) {
                    text = split[3];
                }
                LogBatch b = new LogBatch();
                for (long id = start; id - start < count; id++) {
                    if (((id - start) % 1000) == 0 && id != start) {
                        System.out.println("sending " + id);
                        client.sendBatch(b);
                        b.get_records().clear();
                    }
                    LogRecord record = new LogRecord();
                    record.set_docid("d" + id);
                    record.set_timestamp_ms(System.currentTimeMillis());
                    record.set_index_code(code);
                    if (text != null) {
                        record.set_fields(ImmutableMap.of("text", text));
                    } else {
                        record.set_deleted(true);
                    }
                    b.add_to_records(record);
                }
                if (!b.get_records().isEmpty())
                    client.sendBatch(b);
            }
        }
    }
View Full Code Here

           
            @Override
            protected LogRecord computeNext() {
                while (!failed && !finished && (current == null || currentPosition >= current.size())) {
                    try {
                        LogBatch batch = buffer.take();
                        if (batch == END_BATCH) {
                            finished = true;
                            break;
                        }
                        current = batch.get_records();
                        currentPosition = 0;
                    } catch (InterruptedException e) {
                        continue;
                    }
                }
View Full Code Here

            assertEquals("Record " + (i+1) + " should have id=" + ids[i], ids[i], records.get(i).get_id());
        }
    }

    static LogBatch batch(LogRecord... records) {
        LogBatch b = new LogBatch();
        for (LogRecord r : records) {
            b.add_to_records(r);
        }
        return b;
    }
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.rpc.LogBatch

Copyright © 2018 www.massapicom. 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.