// Copyright (C) 2018 The Syncthing Authors.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

syntax = "proto3";

package main;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.goproto_getters_all) = false;

message DatabaseRecord {
    repeated DatabaseAddress addresses = 1 [(gogoproto.nullable) = false];
    int32                    misses    = 2; // Number of lookups* without hits
    int64                    seen      = 3; // Unix nanos, last device announce
    int64                    missed    = 4; // Unix nanos, last* failed lookup
}

// *) Not every lookup results in a write, so may not be completely accurate

message ReplicationRecord {
    string                   key       = 1;
    repeated DatabaseAddress addresses = 2 [(gogoproto.nullable) = false];
    int64                    seen      = 3; // Unix nanos, last device announce
}

message DatabaseAddress {
    string address = 1;
    int64  expires = 2; // Unix nanos
}
