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

Method CreateOracle

service/oracles.go:23–32  ·  view source on GitHub ↗

CreateOracle compiles and stores a raw *pb.Oracle object. If successful, the identifier of the newly created oracle is returned as the response message.

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

Source from the content-addressed store, hash-verified

21// CreateOracle compiles and stores a raw *pb.Oracle object. If successful, the
22// identifier of the newly created oracle is returned as the response message.
23func (s *Service) CreateOracle(ctx context.Context, oracle *pb.Oracle) (*pb.OracleResponse, error) {
24 if compiled, err := compile(oracle); err != nil {
25 return errOracleResponse("%s", err), nil
26 } else if err := s.oracles.Create(oracle); err != nil {
27 return errOracleResponse("%s", err), nil
28 } else {
29 s.cache.Add(oracle.Id, compiled)
30 }
31 return &pb.OracleResponse{Success: true, Msg: fmt.Sprintf("%d", oracle.Id)}, nil
32}
33
34// UpdateOracle updates the contents of an oracle with the ones of a raw *pb.Oracle
35// object given its identifier.

Callers

nothing calls this directly

Calls 4

compileFunction · 0.85
errOracleResponseFunction · 0.85
AddMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected