Distributed Database System-Implementation of business travel booking system (5)

Source: Internet
Author: User
Data Interface Construction

The interface is designed mainly in the component class. The server can refactor it through the integrated interface, and the client calls the interface to implement the function.

The Interface Class exposes the methods, return values, and parameter types that the client needs to call.

// The interface class public interface icarremoteservice {Boolean hascontrolled {Get; set;} // whether the data class has been occupied by other customers void begintransaction (string Xid ); void committransaction (string Xid); void rollback (string Xid); void searchcaravail (string location, ref int availnum); Boolean insertcar (string locationstring, int price, int numcars ); boolean deletecar (string locationstring); List <car> retallcar (); // returns all car rental information Boolean fixcar (string locationstring); // book a car somewhere}

 

Common method hascontrol: the type is boolean. Indicates whether the data class is currently available. In future transaction processing, when a method needs to operate the dataset, the flag location must be set to true, in this way, the terminus will not allow other programs to operate on this data set.

The public method begintransaction (), the parameter to be passed is the transaction number. This method is used to perform previous operations on the data set, such as locking and data backup.

The public method committransaction () is used to perform operations on the data set when the transaction is committed.

The public method rollback () is used to perform operations on the data set when the transaction is canceled. The data is restored to the corresponding backup status based on the passed transaction number.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.