MCPcopy Create free account
hub / github.com/evilsocket/sum / UpdateOracle

Method UpdateOracle

service/oracles.go:36–45  ·  view source on GitHub ↗

UpdateOracle updates the contents of an oracle with the ones of a raw *pb.Oracle object given its identifier.

(ctx context.Context, oracle *pb.Oracle)

Source from the content-addressed store, hash-verified

34// UpdateOracle updates the contents of an oracle with the ones of a raw *pb.Oracle
35// object given its identifier.
36func (s *Service) UpdateOracle(ctx context.Context, oracle *pb.Oracle) (*pb.OracleResponse, error) {
37 if compiled, err := compile(oracle); err != nil {
38 return errOracleResponse("%s", err), nil
39 } else if err := s.oracles.Update(oracle); err != nil {
40 return errOracleResponse("%s", err), nil
41 } else {
42 s.cache.Add(oracle.Id, compiled)
43 }
44 return &pb.OracleResponse{Success: true}, nil
45}
46
47// ReadOracle returns a raw *pb.Oracle object given its identifier.
48func (s *Service) ReadOracle(ctx context.Context, query *pb.ById) (*pb.OracleResponse, error) {

Callers

nothing calls this directly

Calls 4

compileFunction · 0.85
errOracleResponseFunction · 0.85
AddMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected