Replace deprecated methods in DatastoreAPI

Replace deprecated methods, and fix the coding styles.