Search in sources :

Example 1 with SimpleFileStorage

use of org.neo4j.causalclustering.core.state.storage.SimpleFileStorage in project neo4j by neo4j.

the class ClusterBindingIT method changeClusterId.

private void changeClusterId(CoreClusterMember coreMember) throws IOException {
    SimpleStorage<ClusterId> clusterIdStorage = new SimpleFileStorage<>(fs, coreMember.clusterStateDirectory(), CLUSTER_ID_NAME, new ClusterId.Marshal(), NullLogProvider.getInstance());
    clusterIdStorage.writeState(new ClusterId(UUID.randomUUID()));
}
Also used : SimpleFileStorage(org.neo4j.causalclustering.core.state.storage.SimpleFileStorage) ClusterId(org.neo4j.causalclustering.identity.ClusterId)

Example 2 with SimpleFileStorage

use of org.neo4j.causalclustering.core.state.storage.SimpleFileStorage in project neo4j by neo4j.

the class DumpClusterStateTest method createStates.

private void createStates() throws IOException {
    SimpleStorage<MemberId> memberIdStorage = new SimpleFileStorage<>(fsa.get(), clusterStateDirectory.get(), CORE_MEMBER_ID_NAME, new MemberId.Marshal(), NullLogProvider.getInstance());
    memberIdStorage.writeState(new MemberId(UUID.randomUUID()));
    createDurableState(LAST_FLUSHED_NAME, new LongIndexMarshal());
    createDurableState(LOCK_TOKEN_NAME, new ReplicatedLockTokenState.Marshal(new MemberId.Marshal()));
    createDurableState(ID_ALLOCATION_NAME, new IdAllocationState.Marshal());
    createDurableState(SESSION_TRACKER_NAME, new GlobalSessionTrackerState.Marshal(new MemberId.Marshal()));
    /* raft state */
    createDurableState(RAFT_MEMBERSHIP_NAME, new RaftMembershipState.Marshal());
    createDurableState(RAFT_TERM_NAME, new TermState.Marshal());
    createDurableState(RAFT_VOTE_NAME, new VoteState.Marshal(new MemberId.Marshal()));
}
Also used : IdAllocationState(org.neo4j.causalclustering.core.state.machines.id.IdAllocationState) GlobalSessionTrackerState(org.neo4j.causalclustering.core.replication.session.GlobalSessionTrackerState) MemberId(org.neo4j.causalclustering.identity.MemberId) SimpleFileStorage(org.neo4j.causalclustering.core.state.storage.SimpleFileStorage) VoteState(org.neo4j.causalclustering.core.consensus.vote.VoteState) ReplicatedLockTokenState(org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenState) RaftMembershipState(org.neo4j.causalclustering.core.consensus.membership.RaftMembershipState) StateMarshal(org.neo4j.causalclustering.core.state.storage.StateMarshal) TermState(org.neo4j.causalclustering.core.consensus.term.TermState)

Example 3 with SimpleFileStorage

use of org.neo4j.causalclustering.core.state.storage.SimpleFileStorage in project neo4j by neo4j.

the class DumpClusterState method dump.

void dump() throws IOException {
    SimpleStorage<MemberId> memberIdStorage = new SimpleFileStorage<>(fs, clusterStateDirectory, CORE_MEMBER_ID_NAME, new Marshal(), NullLogProvider.getInstance());
    if (memberIdStorage.exists()) {
        MemberId memberId = memberIdStorage.readState();
        out.println(CORE_MEMBER_ID_NAME + ": " + memberId);
    }
    dumpState(LAST_FLUSHED_NAME, new LongIndexMarshal());
    dumpState(LOCK_TOKEN_NAME, new ReplicatedLockTokenState.Marshal(new Marshal()));
    dumpState(ID_ALLOCATION_NAME, new IdAllocationState.Marshal());
    dumpState(SESSION_TRACKER_NAME, new GlobalSessionTrackerState.Marshal(new Marshal()));
    /* raft state */
    dumpState(RAFT_MEMBERSHIP_NAME, new RaftMembershipState.Marshal());
    dumpState(RAFT_TERM_NAME, new TermState.Marshal());
    dumpState(RAFT_VOTE_NAME, new VoteState.Marshal(new Marshal()));
}
Also used : IdAllocationState(org.neo4j.causalclustering.core.state.machines.id.IdAllocationState) GlobalSessionTrackerState(org.neo4j.causalclustering.core.replication.session.GlobalSessionTrackerState) MemberId(org.neo4j.causalclustering.identity.MemberId) SimpleFileStorage(org.neo4j.causalclustering.core.state.storage.SimpleFileStorage) VoteState(org.neo4j.causalclustering.core.consensus.vote.VoteState) ReplicatedLockTokenState(org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenState) RaftMembershipState(org.neo4j.causalclustering.core.consensus.membership.RaftMembershipState) Marshal(org.neo4j.causalclustering.identity.MemberId.Marshal) StateMarshal(org.neo4j.causalclustering.core.state.storage.StateMarshal) TermState(org.neo4j.causalclustering.core.consensus.term.TermState)

Aggregations

SimpleFileStorage (org.neo4j.causalclustering.core.state.storage.SimpleFileStorage)3 RaftMembershipState (org.neo4j.causalclustering.core.consensus.membership.RaftMembershipState)2 TermState (org.neo4j.causalclustering.core.consensus.term.TermState)2 VoteState (org.neo4j.causalclustering.core.consensus.vote.VoteState)2 GlobalSessionTrackerState (org.neo4j.causalclustering.core.replication.session.GlobalSessionTrackerState)2 IdAllocationState (org.neo4j.causalclustering.core.state.machines.id.IdAllocationState)2 ReplicatedLockTokenState (org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenState)2 StateMarshal (org.neo4j.causalclustering.core.state.storage.StateMarshal)2 MemberId (org.neo4j.causalclustering.identity.MemberId)2 ClusterId (org.neo4j.causalclustering.identity.ClusterId)1 Marshal (org.neo4j.causalclustering.identity.MemberId.Marshal)1