func (s *Shard) RunFunc(executionContext ArgumentContext) (interface{}, error) {
	// TODO: ensure in exportedFuncs

	s.executionLock.Lock()
	defer s.executionLock.Unlock()

	fnName := executionContext.GetFunction()

	fnToCall, found := s.Module.Export.Entries[fnName]
	if !found {
		return nil, fmt.Errorf("could not find function %s", fnName)
	}

	s.ExecutionContext = executionContext
	s.err = nil

	out, err := s.VM.ExecCode(int64(fnToCall.Index))

	// set this to nil because we should re-set it every time we run a function
	s.ExecutionContext = nil

	if err != nil {
		return nil, err
	}

	if s.err != nil {
		return nil, s.err
	}

	return out, nil
}
// RunFunc runs a shard function
RunFunc runs a shard function
// RunFunc runs a shard function
func (s *Shard) RunFunc(executionContext ArgumentContext) (interface{}, error) {
	s.executionLock.Lock()
	defer s.executionLock.Unlock()
	fnName := executionContext.GetFunction()
	fnToCall, found := s.Module.Export.Entries[fnName]
	if !found {
		return nil, fmt.Errorf("could not find function %s", fnName)
	}
	s.ExecutionContext = executionContext
	s.err = nil
	out, err := s.VM.ExecCode(int64(fnToCall.Index))
	s.ExecutionContext = nil
	if err != nil {
		return nil, err
	}
	if s.err != nil {
		return nil, s.err
	}
	return out, nil
}
func ( s * Shard ) RunFunc ( executionContext ArgumentContext ) ( interface { } , error ) { s . executionLock . Lock ( ) defer s . executionLock . Unlock ( ) fnName := executionContext . GetFunction ( ) fnToCall , found := s . Module . Export . Entries [ fnName ] if ! found { return nil , fmt . Errorf ( " " , fnName ) } s . ExecutionContext = executionContext s . err = nil out , err := s . VM . ExecCode ( int64 ( fnToCall . Index ) ) s . ExecutionContext = nil if err != nil { return nil , err } if s . err != nil { return nil , s . err } return out , nil }
RunFunc runs a shard function
RunFunc runs a shard function
// TODO: ensure in exportedFuncs // set this to nil because we should re-set it every time we run a function