rpc: Add UNKNOWN connection status for contacts
UNKNOWN is the new default status for contacts. A contact is in the UNKNOWN state when we're not sure whether they are available or not, and is in the OFFLINE state when we believe that we're online but attempts to connect to that contact have failed.
This commit is contained in:
parent
346971368b
commit
6e68f861d8
|
@ -16,23 +16,26 @@ var _ = math.Inf
|
||||||
type Contact_Status int32
|
type Contact_Status int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Contact_OFFLINE Contact_Status = 0
|
Contact_UNKNOWN Contact_Status = 0
|
||||||
Contact_ONLINE Contact_Status = 1
|
Contact_OFFLINE Contact_Status = 1
|
||||||
Contact_REQUEST Contact_Status = 2
|
Contact_ONLINE Contact_Status = 2
|
||||||
Contact_REJECTED Contact_Status = 3
|
Contact_REQUEST Contact_Status = 3
|
||||||
|
Contact_REJECTED Contact_Status = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
var Contact_Status_name = map[int32]string{
|
var Contact_Status_name = map[int32]string{
|
||||||
0: "OFFLINE",
|
0: "UNKNOWN",
|
||||||
1: "ONLINE",
|
1: "OFFLINE",
|
||||||
2: "REQUEST",
|
2: "ONLINE",
|
||||||
3: "REJECTED",
|
3: "REQUEST",
|
||||||
|
4: "REJECTED",
|
||||||
}
|
}
|
||||||
var Contact_Status_value = map[string]int32{
|
var Contact_Status_value = map[string]int32{
|
||||||
"OFFLINE": 0,
|
"UNKNOWN": 0,
|
||||||
"ONLINE": 1,
|
"OFFLINE": 1,
|
||||||
"REQUEST": 2,
|
"ONLINE": 2,
|
||||||
"REJECTED": 3,
|
"REQUEST": 3,
|
||||||
|
"REJECTED": 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x Contact_Status) String() string {
|
func (x Contact_Status) String() string {
|
||||||
|
@ -306,36 +309,37 @@ func init() {
|
||||||
func init() { proto.RegisterFile("contact.proto", fileDescriptor1) }
|
func init() { proto.RegisterFile("contact.proto", fileDescriptor1) }
|
||||||
|
|
||||||
var fileDescriptor1 = []byte{
|
var fileDescriptor1 = []byte{
|
||||||
// 495 bytes of a gzipped FileDescriptorProto
|
// 503 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x53, 0xd1, 0x6e, 0xd3, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x53, 0x51, 0x6f, 0xd3, 0x30,
|
||||||
0x14, 0x5d, 0x9a, 0x2c, 0x69, 0x6f, 0xb7, 0xd2, 0x59, 0x13, 0x0a, 0xec, 0x65, 0xb2, 0x10, 0xe2,
|
0x10, 0x5e, 0x9a, 0x2c, 0x69, 0xaf, 0x5b, 0xe9, 0xac, 0x09, 0x05, 0xf6, 0x32, 0x59, 0x08, 0xf1,
|
||||||
0x85, 0x80, 0x0a, 0x8f, 0x48, 0xac, 0x6b, 0x32, 0x51, 0x14, 0x92, 0xe2, 0x25, 0x1f, 0x90, 0x26,
|
0x42, 0x40, 0x85, 0x77, 0xd6, 0x35, 0x99, 0x28, 0x84, 0xa4, 0x78, 0x89, 0x78, 0x4e, 0x13, 0x4b,
|
||||||
0x96, 0x16, 0x28, 0x4e, 0x49, 0x5c, 0x60, 0xdf, 0xc6, 0x2b, 0x1f, 0xc4, 0x27, 0x60, 0x3b, 0x4e,
|
0x0b, 0x14, 0xa7, 0x24, 0x2e, 0xb0, 0xff, 0xc7, 0x03, 0x3f, 0x87, 0x9f, 0x80, 0xed, 0x38, 0x1d,
|
||||||
0xc7, 0x36, 0x40, 0x68, 0x6f, 0xd7, 0xf7, 0x9c, 0xeb, 0x7b, 0xcf, 0x3d, 0x36, 0xec, 0xe7, 0x15,
|
0xdb, 0x00, 0x21, 0xde, 0xee, 0xee, 0xfb, 0xce, 0x77, 0xdf, 0xdd, 0x19, 0xf6, 0xf3, 0x8a, 0xf1,
|
||||||
0xe3, 0x59, 0xce, 0xbd, 0x75, 0x5d, 0xf1, 0x0a, 0xf5, 0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1c, 0xfa, 0x74, 0x45, 0x39,
|
0x70, 0x9a, 0xcd, 0xf2, 0xbd, 0x18, 0x15, 0x3e, 0x80, 0x3b, 0xd3, 0xa2, 0xd8, 0xd6, 0x5a, 0xaf,
|
||||||
0xbd, 0xe1, 0xf5, 0x7f, 0x7f, 0x18, 0x7c, 0x08, 0xe8, 0xc6, 0x0d, 0xf2, 0xde, 0x23, 0x78, 0x40,
|
0x2e, 0xf1, 0x09, 0x1c, 0xfa, 0x74, 0x45, 0x39, 0xbd, 0xb1, 0xeb, 0x7f, 0xfe, 0x3d, 0xf8, 0x10,
|
||||||
0xa8, 0x6c, 0x3a, 0x67, 0xcb, 0x6a, 0xc3, 0x8a, 0xee, 0x3d, 0x4b, 0x70, 0x69, 0xab, 0xaf, 0xfa,
|
0xd0, 0x8d, 0x17, 0xe4, 0xbb, 0x47, 0x70, 0x8f, 0x50, 0x59, 0x74, 0xce, 0x96, 0xd5, 0x86, 0x15,
|
||||||
0xe2, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa1, 0xab, 0x53, 0xdb, 0xbb, 0x03, 0x00, 0x00,
|
0xdd, 0x71, 0x4b, 0x70, 0x69, 0xab, 0x7f, 0xfb, 0xec, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53,
|
||||||
|
0x03, 0x9d, 0x60, 0xc8, 0x03, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package ricochet;
|
package ricochet;
|
||||||
|
|
||||||
|
// XXX Using integer contact IDs seems dangerous, and it's especially a
|
||||||
|
// problem that 0 is a valid contact ID. Switch to UUID? Or use address?
|
||||||
|
|
||||||
message Contact {
|
message Contact {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
string address = 2;
|
string address = 2;
|
||||||
|
@ -10,10 +13,11 @@ message Contact {
|
||||||
ContactRequest request = 6;
|
ContactRequest request = 6;
|
||||||
|
|
||||||
enum Status {
|
enum Status {
|
||||||
OFFLINE = 0;
|
UNKNOWN = 0;
|
||||||
ONLINE = 1;
|
OFFLINE = 1;
|
||||||
REQUEST = 2;
|
ONLINE = 2;
|
||||||
REJECTED = 3;
|
REQUEST = 3;
|
||||||
|
REJECTED = 4;
|
||||||
}
|
}
|
||||||
Status status = 10;
|
Status status = 10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,11 @@ type RicochetCoreClient interface {
|
||||||
StopNetwork(ctx context.Context, in *StopNetworkRequest, opts ...grpc.CallOption) (*NetworkStatus, error)
|
StopNetwork(ctx context.Context, in *StopNetworkRequest, opts ...grpc.CallOption) (*NetworkStatus, error)
|
||||||
// XXX Service status
|
// XXX Service status
|
||||||
GetIdentity(ctx context.Context, in *IdentityRequest, opts ...grpc.CallOption) (*Identity, error)
|
GetIdentity(ctx context.Context, in *IdentityRequest, opts ...grpc.CallOption) (*Identity, error)
|
||||||
|
// Query contacts and monitor for contact changes. The full contact list
|
||||||
|
// is sent in POPULATE events, terminated by a POPULATE event with no
|
||||||
|
// subject. Any new, removed, or modified contacts, including changes in
|
||||||
|
// the state of contacts, are sent as ADD, UPDATE, or DELETE events until
|
||||||
|
// the stream is closed.
|
||||||
MonitorContacts(ctx context.Context, in *MonitorContactsRequest, opts ...grpc.CallOption) (RicochetCore_MonitorContactsClient, error)
|
MonitorContacts(ctx context.Context, in *MonitorContactsRequest, opts ...grpc.CallOption) (RicochetCore_MonitorContactsClient, error)
|
||||||
AddContactRequest(ctx context.Context, in *ContactRequest, opts ...grpc.CallOption) (*Contact, error)
|
AddContactRequest(ctx context.Context, in *ContactRequest, opts ...grpc.CallOption) (*Contact, error)
|
||||||
UpdateContact(ctx context.Context, in *Contact, opts ...grpc.CallOption) (*Contact, error)
|
UpdateContact(ctx context.Context, in *Contact, opts ...grpc.CallOption) (*Contact, error)
|
||||||
|
@ -285,6 +290,11 @@ type RicochetCoreServer interface {
|
||||||
StopNetwork(context.Context, *StopNetworkRequest) (*NetworkStatus, error)
|
StopNetwork(context.Context, *StopNetworkRequest) (*NetworkStatus, error)
|
||||||
// XXX Service status
|
// XXX Service status
|
||||||
GetIdentity(context.Context, *IdentityRequest) (*Identity, error)
|
GetIdentity(context.Context, *IdentityRequest) (*Identity, error)
|
||||||
|
// Query contacts and monitor for contact changes. The full contact list
|
||||||
|
// is sent in POPULATE events, terminated by a POPULATE event with no
|
||||||
|
// subject. Any new, removed, or modified contacts, including changes in
|
||||||
|
// the state of contacts, are sent as ADD, UPDATE, or DELETE events until
|
||||||
|
// the stream is closed.
|
||||||
MonitorContacts(*MonitorContactsRequest, RicochetCore_MonitorContactsServer) error
|
MonitorContacts(*MonitorContactsRequest, RicochetCore_MonitorContactsServer) error
|
||||||
AddContactRequest(context.Context, *ContactRequest) (*Contact, error)
|
AddContactRequest(context.Context, *ContactRequest) (*Contact, error)
|
||||||
UpdateContact(context.Context, *Contact) (*Contact, error)
|
UpdateContact(context.Context, *Contact) (*Contact, error)
|
||||||
|
|
Loading…
Reference in New Issue