focalboard/mattermost-plugin/server/boards/mutex_adapter.go
Miguel de la Cruz 4b0fb92fba
Multi product architecture (#3381)
- provides support for compiling Boards directly into the Mattermost suite server
- a ServicesAPI interface replaces the PluginAPI to allow for implementations coming from pluginAPI and suite server.
- a new product package provides a place to register Boards as a suite product and handles life-cycle events
- a new boards package replaces much of the mattermost-plugin logic, allowing this to be shared between plugin and product
- Boards now uses module workspaces; run make setup-go-work
2022-07-18 13:21:57 -04:00

34 lines
935 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package boards
import (
"errors"
"net/http"
mm_model "github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/focalboard/server/model"
)
type mutexAPIAdapter struct {
api model.ServicesAPI
}
func (m *mutexAPIAdapter) KVSetWithOptions(key string, value []byte, options mm_model.PluginKVSetOptions) (bool, *mm_model.AppError) {
b, err := m.api.KVSetWithOptions(key, value, options)
var appErr *mm_model.AppError
if err != nil {
if !errors.As(err, &appErr) {
appErr = mm_model.NewAppError("KVSetWithOptions", "", nil, "", http.StatusInternalServerError)
}
}
return b, appErr
}
func (m *mutexAPIAdapter) LogError(msg string, keyValuePairs ...interface{}) {
m.api.GetLogger().Error(msg, mlog.Array("kvpairs", keyValuePairs))
}