use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.
the class TestRaftLogReadWrite method setup.
@Before
public void setup() throws Exception {
storageDir = getTestDir();
RaftProperties properties = new RaftProperties();
RaftServerConfigKeys.setStorageDir(properties, storageDir);
this.segmentMaxSize = RaftServerConfigKeys.Log.segmentSizeMax(properties).getSize();
this.preallocatedSize = RaftServerConfigKeys.Log.preallocatedSize(properties).getSize();
this.bufferSize = RaftServerConfigKeys.Log.writeBufferSize(properties).getSizeInt();
}
use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.
the class Client method run.
@Override
public void run() throws Exception {
int raftSegmentPreallocatedSize = 1024 * 1024 * 1024;
RaftProperties raftProperties = new RaftProperties();
RaftConfigKeys.Rpc.setType(raftProperties, SupportedRpcType.GRPC);
GrpcConfigKeys.setMessageSizeMax(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize));
RaftServerConfigKeys.Log.Appender.setBufferByteLimit(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize));
RaftServerConfigKeys.Log.setWriteBufferSize(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize));
RaftServerConfigKeys.Log.setPreallocatedSize(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize));
RaftServerConfigKeys.Log.setSegmentSizeMax(raftProperties, SizeInBytes.valueOf(1 * 1024 * 1024 * 1024L));
RaftConfigKeys.DataStream.setType(raftProperties, SupportedDataStreamType.NETTY);
RaftServerConfigKeys.Log.setSegmentCacheNumMax(raftProperties, 2);
RaftClientConfigKeys.Rpc.setRequestTimeout(raftProperties, TimeDuration.valueOf(50000, TimeUnit.MILLISECONDS));
RaftClientConfigKeys.Async.setOutstandingRequestsMax(raftProperties, 1000);
for (File dir : storageDir) {
FileUtils.createDirectories(dir);
}
operation(getClients(raftProperties));
}
use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.
the class TestRaftServerWithGrpc method setup.
@Before
public void setup() {
final RaftProperties p = getProperties();
p.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY, SimpleStateMachine4Testing.class, StateMachine.class);
RaftClientConfigKeys.Rpc.setRequestTimeout(p, TimeDuration.valueOf(1, TimeUnit.SECONDS));
}
use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.
the class TestDataStreamDisabled method testDataStreamDisabled.
@Test
public void testDataStreamDisabled() {
final RaftProperties properties = new RaftProperties();
Assert.assertEquals(SupportedDataStreamType.DISABLED, RaftConfigKeys.DataStream.type(properties, LOG::info));
final RaftPeer server = RaftPeer.newBuilder().setId("s0").build();
final RaftClient client = RaftClient.newBuilder().setRaftGroup(RaftGroup.valueOf(RaftGroupId.randomId(), server)).setProperties(properties).build();
exception.expect(UnsupportedOperationException.class);
exception.expectMessage(DisabledDataStreamClientFactory.class.getName() + "$1 does not support streamAsync");
// stream() will create a header request, thus it will hit UnsupportedOperationException due to
// DisabledDataStreamFactory.
client.getDataStreamApi().stream();
}
use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.
the class TestLogSegment method setup.
@Before
public void setup() {
RaftProperties properties = new RaftProperties();
storageDir = getTestDir();
RaftServerConfigKeys.setStorageDir(properties, Collections.singletonList(storageDir));
this.segmentMaxSize = RaftServerConfigKeys.Log.segmentSizeMax(properties).getSize();
this.preallocatedSize = RaftServerConfigKeys.Log.preallocatedSize(properties).getSize();
this.bufferSize = RaftServerConfigKeys.Log.writeBufferSize(properties).getSizeInt();
}
Aggregations