This allows nodes to keep track of history and avoid tampering.
type Ledger struct {
owner NodeId
partner NodeId
bytes_sent int
bytes_recv int
timestamp Timestamp
}
// CallUnary | |
// [3]reflect.Value in[0] is context.Context, in[1] is your message type which generated by pb file. | |
// in[2] is grpc.CallOption | |
func (c *Client) CallUnary(methodName string,in []reflect.Value)(interface{},error) { | |
m, ok := reflect.TypeOf(c.c).MethodByName(methodName) | |
if !ok{ | |
log.Fatal("method not found") | |
return nil,errors.New("method not found") | |
} |
This allows nodes to keep track of history and avoid tampering.
type Ledger struct {
owner NodeId
partner NodeId
bytes_sent int
bytes_recv int
timestamp Timestamp
}
func (s SqlTokenStore) Save(token *model.Token) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
if result.Err = token.IsValid(); result.Err != nil {
return
}
if err := s.GetMaster().Insert(token); err != nil {
result.Err = model.NewAppError("SqlTokenStore.Save", "store.sql_recover.save.app_error", nil, "", http.StatusInternalServerError)
}
<-------------------------------> 个人网站