Public Member Functions | Protected Attributes

Synchronization Class Reference

To synchronize the events. More...

#import <Synchronization.h>

List of all members.

Public Member Functions

(void) - initialization
 This method is called once after allocating and initializing Synchronization class in app delegate's method application:didFinishLaunchingWithOptions.
(void) - generateRequest:
 Below method is invoked as a result of various user interactions like Inserting an event, Deleting an event, and Editing an event.
(Request *) - computeBFOfRequest:
 This method is called when we want to compute backward form of a request again our log.
(void) - canonizeRequest:
 This method is called when we want to canonize our log.
(NSInteger) - dependencyOfRequest:withRequest:
 This method (dependencyOfRequest:) is called when we want to check whether a particular request is depenent on a request in the log or not.
(Request *) - ETofRequest:withRequest:
 This method is called when we want to exclusively transform our request with a request from requestLog (obviously, when there is no dependency..).
(BOOL) - integrateRemoteRequest
 This method is called when we receive a co-operative request via receiveRequest: method.
(Request *) - computeFFOfRequest:
 This method is called when we want to compute the forward form of our request.
(void) - ITofRequest:withRequest:
 This method is called when we want to inclusively transform our request.
(void) - receiveRequest:
 This method is called whenever we receive any request from other peers (through network).
(BOOL) - Check_Local:
 Below method will check whether this local operation is authorized or not by checking policy of creator/owner of that event.
(BOOL) - Check_Remote:
 This method will check remote requests whether they can be executed on our local copy of calendar or not.
(NSMutableArray *) - getInsRequestLog
 This method (getInsRequestLog:) is called when we want to get the insRequestLog in other classes.
(NSMutableArray *) - getDelUpdateRequestLog
 This method is called when we want to get the delUpdateequestLog in other classes.
(NSMutableDictionary *) - getInsRequestDictionary
 This method (getInsRequestDictionary:) is called when we want to get the insRequestDictionary in other classes.
(NSMutableDictionary *) - getDelUpdateRequestDictionary
 This method is called when we want to get the delUpdateequestDictionary in other classes.

Protected Attributes

NSMutableArray * remoteRequestBuffer
 The buffer to store remote requests.
NSMutableArray * insRequestLog
 The log containing insert requests.
NSMutableArray * delUpdateRequestLog
 The log containing del/update requests.
NSMutableDictionary * insRequestDictionary
 Used in function canonize to get the position of the ins request in the log.
NSMutableDictionary * delUpdateRequestDictionary
 Used in function canonize to get the position of the del/update request in the log.
NSInteger r
 The unique number used in generating co-operative request.
NSUInteger c
 Unique peerID of the peer.
NSInteger firstDelPosition
 Used in function canonize.

Detailed Description

To synchronize the events.


Member Function Documentation

- (void) canonizeRequest: (Request*)  requestLocal

This method is called when we want to canonize our log.

Parameters:
requestLocalthe request which we are going to add in the log
- (BOOL) Check_Local: (id)  operation

Below method will check whether this local operation is authorized or not by checking policy of creator/owner of that event.

Parameters:
operationoperation (insert, delete or edit) to check
Returns:
boolean (YES or NO) depending on operation is allowed or not respectively
- (BOOL) Check_Remote: (Request *)  myRequest

This method will check remote requests whether they can be executed on our local copy of calendar or not.

Parameters:
myRequestremote request
Returns:
boolean value depending on remote request's operation is allowed to execute or not
- (Request *) computeBFOfRequest: (Request*)  request

This method is called when we want to compute backward form of a request again our log.

Parameters:
requestthe request of which backward form has to be computed!!
Returns:
new request
- (Request *) computeFFOfRequest: (Request*)  req

This method is called when we want to compute the forward form of our request.

Parameters:
reqthe request of which we want to compute forward form
Returns:
new request
- (NSInteger) dependencyOfRequest: (Request*)  newRequest
withRequest: (Request*)  requestFromLog 

This method (dependencyOfRequest:) is called when we want to check whether a particular request is depenent on a request in the log or not.

Parameters:
newRequestthe request of which dependency has to be checked
requestFromLogour current log with which to check the dependency
Returns:
0 if there is no dependency; otherwise, number of dependency (1 to 5)
- (Request *) ETofRequest: (Request*)  newRequest
withRequest: (Request*)  requestFromLog 

This method is called when we want to exclusively transform our request with a request from requestLog (obviously, when there is no dependency..).

Parameters:
newRequestthe request which we want to be transformed exclusively
requestFromLogour request log
Returns:
new request (exclusively transformed)
- (void) generateRequest: (id)  operation

Below method is invoked as a result of various user interactions like Inserting an event, Deleting an event, and Editing an event.

Parameters:
operationthe operation(insert,delete or edit)
- (NSMutableDictionary *) getDelUpdateRequestDictionary

This method is called when we want to get the delUpdateequestDictionary in other classes.

Returns:
delUpdateRequestDictionary (mutable dictionary)
- (NSMutableArray *) getDelUpdateRequestLog

This method is called when we want to get the delUpdateequestLog in other classes.

Returns:
delUpdateequestLog (mutable array)
- (NSMutableDictionary *) getInsRequestDictionary

This method (getInsRequestDictionary:) is called when we want to get the insRequestDictionary in other classes.

Returns:
insRequestDictionary (mutable dictionary)
- (NSMutableArray *) getInsRequestLog

This method (getInsRequestLog:) is called when we want to get the insRequestLog in other classes.

Returns:
insRequestLog (mutable array)
- (void) initialization

This method is called once after allocating and initializing Synchronization class in app delegate's method application:didFinishLaunchingWithOptions.

- (BOOL) integrateRemoteRequest

This method is called when we receive a co-operative request via receiveRequest: method.

This method is called in receiveRequest: method till we don't find any request in the remoteRequestLog which is causally-ready i.e. we stop when we don't find any request in the remoteRequestLog which is causally-ready i.e. either remoteRequestLog is empty or the requests present are not causally-ready to execute on our local copy of calendar

Returns:
Boolean value depending on whether we found a causally-ready request or not
- (void) ITofRequest: (Request*)  ofRequest
withRequest: (Request*)  withRequest 

This method is called when we want to inclusively transform our request.

Parameters:
ofRequestthe request which we want to be transformed inclusively
withRequestthe reqeust with which to transform other reqeust inclusively
- (void) receiveRequest: (Request *)  receiveRequest

This method is called whenever we receive any request from other peers (through network).

It adds remote co-operative request received from network to our remoteRequestLog and calls integrateRemoteRequest method until all causally-ready requests are executed on our site.

Parameters:
receiveRequestrequest received from other peers

Member Data Documentation

- (NSUInteger) c [protected]

Unique peerID of the peer.

- (NSMutableDictionary*) delUpdateRequestDictionary [protected]

Used in function canonize to get the position of the del/update request in the log.

- (NSMutableArray*) delUpdateRequestLog [protected]

The log containing del/update requests.

- (NSInteger) firstDelPosition [protected]

Used in function canonize.

- (NSMutableDictionary*) insRequestDictionary [protected]

Used in function canonize to get the position of the ins request in the log.

- (NSMutableArray*) insRequestLog [protected]

The log containing insert requests.

- (NSInteger) r [protected]

The unique number used in generating co-operative request.

- (NSMutableArray*) remoteRequestBuffer [protected]

The buffer to store remote requests.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Properties