environment.go 895 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package remote_manager
  2. import (
  3. "fmt"
  4. "github.com/langgenius/dify-plugin-daemon/internal/types/entities/plugin_entities"
  5. )
  6. func (r *RemotePluginRuntime) Identity() (plugin_entities.PluginUniqueIdentifier, error) {
  7. // copy a new declaration
  8. config := r.Config
  9. config.Author = r.tenantId
  10. checksum, _ := r.Checksum()
  11. return plugin_entities.NewPluginUniqueIdentifier(fmt.Sprintf("%s@%s", config.Identity(), checksum))
  12. }
  13. func (r *RemotePluginRuntime) Cleanup() {
  14. // no cleanup needed
  15. }
  16. func (r *RemotePluginRuntime) WaitStarted() <-chan bool {
  17. r.waitChanLock.Lock()
  18. defer r.waitChanLock.Unlock()
  19. ch := make(chan bool)
  20. r.waitStartedChan = append(r.waitStartedChan, ch)
  21. return ch
  22. }
  23. func (r *RemotePluginRuntime) WaitStopped() <-chan bool {
  24. r.waitChanLock.Lock()
  25. defer r.waitChanLock.Unlock()
  26. ch := make(chan bool)
  27. r.waitStoppedChan = append(r.waitStoppedChan, ch)
  28. return ch
  29. }