forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid duplicate ocbinds schema loading (sonic-net#73)
Introduced a new function ocbinds.GetSchema(), which is equivalent of the generated function ocbinds.Schema(), but loads the schema only once. Translib request_binder and transformer are changed to use the new GetSchema() function. Avoids duplicate schema loads during init. Signed-off-by: Sachin Holla <[email protected]> Co-authored-by: anand-kumar-subramanian <[email protected]>
- Loading branch information
1 parent
3036d3a
commit 80e8035
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// // | ||
// Copyright 2021 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // | ||
// its subsidiaries. // | ||
// // | ||
// Licensed under the Apache License, Version 2.0 (the "License"); // | ||
// you may not use this file except in compliance with the License. // | ||
// You may obtain a copy of the License at // | ||
// // | ||
// http://www.apache.org/licenses/LICENSE-2.0 // | ||
// // | ||
// Unless required by applicable law or agreed to in writing, software // | ||
// distributed under the License is distributed on an "AS IS" BASIS, // | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // | ||
// See the License for the specific language governing permissions and // | ||
// limitations under the License. // | ||
// // | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
package ocbinds | ||
|
||
import ( | ||
"github.com/openconfig/ygot/ytypes" | ||
) | ||
|
||
// GetSchema is equivalent of the Schema function, but avoids | ||
// UnzipSchema call. Reuses the SchemaTree loaded during init. | ||
func GetSchema() (*ytypes.Schema, error) { | ||
return &ytypes.Schema{ | ||
Root: &Device{}, | ||
SchemaTree: SchemaTree, | ||
Unmarshal: Unmarshal, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters