pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 1 | /** |
| 2 | * fb303.thrift |
| 3 | * |
| 4 | * Copyright (c) 2006- Facebook |
| 5 | * Distributed under the Thrift Software License |
| 6 | * |
| 7 | * See accompanying file LICENSE or visit the Thrift site at: |
| 8 | * http://developers.facebook.com/thrift/ |
| 9 | * |
| 10 | * |
| 11 | * Definition of common Facebook data types and status reporting mechanisms |
| 12 | * common to all Facebook services. In some cases, these methods are |
| 13 | * provided in the base implementation, and in other cases they simply define |
| 14 | * methods that inheriting applications should implement (i.e. status report) |
| 15 | * |
| 16 | * @author Mark Slee <mcslee@facebook.com> |
| 17 | */ |
| 18 | |
| 19 | include "thrift/if/reflection_limited.thrift" |
| 20 | |
| 21 | namespace java com.facebook.fb303 |
| 22 | namespace cpp facebook.fb303 |
| 23 | |
| 24 | /** |
| 25 | * Common status reporting mechanism across all services |
| 26 | */ |
| 27 | enum fb_status { |
| 28 | DEAD = 0, |
| 29 | STARTING = 1, |
| 30 | ALIVE = 2, |
| 31 | STOPPING = 3, |
| 32 | STOPPED = 4, |
| 33 | WARNING = 5, |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Standard base service |
| 38 | */ |
| 39 | service FacebookService { |
| 40 | |
| 41 | /** |
| 42 | * Returns a descriptive name of the service |
| 43 | */ |
| 44 | string getName(), |
| 45 | |
| 46 | /** |
| 47 | * Returns the version of the service |
| 48 | */ |
| 49 | string getVersion(), |
| 50 | |
| 51 | /** |
| 52 | * Gets the status of this service |
| 53 | */ |
| 54 | fb_status getStatus(), |
| 55 | |
| 56 | /** |
| 57 | * User friendly description of status, such as why the service is in |
| 58 | * the dead or warning state, or what is being started or stopped. |
| 59 | */ |
| 60 | string getStatusDetails(), |
| 61 | |
| 62 | /** |
| 63 | * Gets the counters for this service |
| 64 | */ |
| 65 | map<string, i64> getCounters(), |
| 66 | |
| 67 | /** |
| 68 | * Gets the value of a single counter |
| 69 | */ |
| 70 | i64 getCounter(1: string key), |
| 71 | |
| 72 | /** |
| 73 | * Sets an option |
| 74 | */ |
| 75 | void setOption(1: string key, 2: string value), |
| 76 | |
| 77 | /** |
| 78 | * Gets an option |
| 79 | */ |
| 80 | string getOption(1: string key), |
| 81 | |
| 82 | /** |
| 83 | * Gets all options |
| 84 | */ |
| 85 | map<string, string> getOptions(), |
| 86 | |
| 87 | /** |
| 88 | * Returns a CPU profile over the given time interval (client and server |
| 89 | * must agree on the profile format). |
| 90 | */ |
| 91 | string getCpuProfile(1: i32 profileDurationInSec), |
| 92 | |
| 93 | /** |
| 94 | * Returns the unix time that the server has been running since |
| 95 | */ |
| 96 | i64 aliveSince(), |
| 97 | |
| 98 | /** |
| 99 | * Returns a limited description of this service. |
| 100 | */ |
| 101 | reflection_limited.Service |
| 102 | getLimitedReflection(), |
| 103 | |
| 104 | /** |
| 105 | * Tell the server to reload its configuration, reopen log files, etc |
| 106 | */ |
| 107 | async void reinitialize(), |
| 108 | |
| 109 | /** |
| 110 | * Suggest a shutdown to the server |
| 111 | */ |
| 112 | async void shutdown(), |
| 113 | |
| 114 | } |