1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.mitosis.common; 21 22 23 import java.io.Serializable; 24 25 26 /** 27 * Represents 'Change Sequence Number' in LDUP specification. 28 * 29 * A CSN is a composition of a timestamp, a replica ID and a 30 * operation sequence number. 31 * 32 * It's described in http://tools.ietf.org/html/draft-sermersheim-ldap-csn-02. 33 * 34 * The syntax is : 35 * <pre> 36 * ChangeSequenceNumber ::= SEQUENCE { 37 * time GeneralizedTime, 38 * timeCount INTEGER (0 .. MaxInt), 39 * replicaID UTF8String, 40 * changeCount INTEGER (0 .. MaxInt)} 41 * } 42 * </pre> 43 * 44 * It distinguishes a change made on an object on a server, 45 * and if two operations take place during the same timeStamp, 46 * the operation sequence number makes those operations distinct. 47 * 48 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 49 */ 50 public interface CSN extends Serializable, Comparable<CSN> 51 { 52 /** 53 * Returns GMT timestamp of modification. 54 */ 55 long getTimestamp(); 56 57 58 /** 59 * Returns replica ID. 60 */ 61 String getReplicaId(); 62 63 64 /** 65 * Returns sequence number of modification. 66 */ 67 int getOperationSequence(); 68 69 70 /** 71 * Returns octet-string representation of this CSN. 72 */ 73 String toOctetString(); 74 75 76 /** 77 * Returns a byte array representing the CSN 78 */ 79 byte[] toBytes(); 80 }