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

Method FindOracle

service/oracles.go:58–71  ·  view source on GitHub ↗

FindOracle returns a list of raw *pb.Oracle objects that match the provided name.

(ctx context.Context, query *pb.ByName)

Source from the content-addressed store, hash-verified

56// FindOracle returns a list of raw *pb.Oracle objects that match
57// the provided name.
58func (s *Service) FindOracle(ctx context.Context, query *pb.ByName) (*pb.OracleResponse, error) {
59 found := (*pb.Oracle)(nil)
60 s.oracles.ForEach(func(m proto.Message) error {
61 if oracle := m.(*pb.Oracle); oracle.Name == query.Name {
62 found = oracle
63 }
64 return nil
65 })
66
67 if found == nil {
68 return errOracleResponse("oracle %s not found.", query.Name), nil
69 }
70 return &pb.OracleResponse{Success: true, Oracle: found}, nil
71}
72
73// DeleteOracle removes an oracle from the storage given its identifier.
74func (s *Service) DeleteOracle(ctx context.Context, query *pb.ById) (*pb.OracleResponse, error) {

Callers

nothing calls this directly

Calls 2

errOracleResponseFunction · 0.85
ForEachMethod · 0.80

Tested by

no test coverage detected