View Javadoc

1   package org.apache.helix.store;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.helix.BaseDataAccessor;
23  
24  public interface HelixPropertyStore<T> extends BaseDataAccessor<T>
25  {
26    /**
27     * Perform resource allocation when property store starts
28     * 
29     * Resource allocation includes: - start an internal thread for fire callbacks
30     * 
31     */
32    public void start();
33  
34    /**
35     * Perform clean up when property store stops
36     * 
37     * Cleanup includes: - stop the internal thread for fire callbacks
38     * 
39     */
40    public void stop();
41  
42    /**
43     * Register a listener to a parent path.
44     * 
45     * Subscribing to a parent path means any changes happening under the parent path will
46     * notify the listener
47     * 
48     * @param parentPath
49     * @param listener
50     */
51    public void subscribe(String parentPath, HelixPropertyListener listener);
52  
53    /**
54     * Remove a listener from a parent path.
55     * 
56     * This will remove the listener from receiving any notifications happening under the
57     * parent path
58     * 
59     * @param parentPath
60     * @param listener
61     */
62    public void unsubscribe(String parentPath, HelixPropertyListener listener);
63  }