Documentation ¶
Overview ¶
* * Copyright 2021 Comcast Cable Communications Management, LLC * * 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. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * 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. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * 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. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * 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. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * 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. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * 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. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * 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. * * SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func FactoryReset(c DatabaseClient, cpeMac string, fields log.Fields) error
- func GetColumnsStr(columns []string) string
- func GetSetColumnsStr(columns []string) string
- func GetValuesStr(length int) string
- type DatabaseClient
- type SqliteClient
- func (c *SqliteClient) DeleteDocument(cpeMac string, groupId string, fields log.Fields) error
- func (c *SqliteClient) DeleteFullDocument(cpeMac string, fields log.Fields) error
- func (c *SqliteClient) DeleteRootDocument(cpeMac string) error
- func (c *SqliteClient) DeleteRootDocumentVersion(cpeMac string) error
- func (c *SqliteClient) GetDocument(cpeMac string, groupId string, fields log.Fields) (*common.Document, error)
- func (c *SqliteClient) GetFolder(cpeMac string, fields log.Fields) (*common.Folder, error)
- func (c *SqliteClient) GetRootDocument(cpeMac string) (*common.RootDocument, error)
- func (c *SqliteClient) IsDbNotFound(err error) bool
- func (c *SqliteClient) SetDocument(cpeMac string, groupId string, doc *common.Document, fields log.Fields) error
- func (c *SqliteClient) SetRootDocumentBitmap(cpeMac string, bitmap int) error
- func (c *SqliteClient) SetRootDocumentVersion(cpeMac string, version string) error
- func (c *SqliteClient) SetUp() error
- func (c *SqliteClient) TearDown() error
Constants ¶
const (
CreateKeyspaceStatement = `CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}`
)
Variables ¶
var ( SqliteAllTables = []string{} SqliteCreateTableStatements = []string{ `CREATE TABLE IF NOT EXISTS xpc_group_config ( cpe_mac text NOT NULL, group_id text NOT NULL, params text, updated_time timestamp, version text, payload blob, state int, PRIMARY KEY (cpe_mac, group_id) )`, `CREATE TABLE IF NOT EXISTS root_document ( cpe_mac text PRIMARY KEY, version text, bitmap bigint )`, } )
var (
XpcFactoryResetTables = []string{
"root_document",
"xpc_group_config",
}
)
Functions ¶
func FactoryReset ¶
func FactoryReset(c DatabaseClient, cpeMac string, fields log.Fields) error
func GetColumnsStr ¶
func GetSetColumnsStr ¶
func GetValuesStr ¶
Types ¶
type DatabaseClient ¶
type DatabaseClient interface { SetUp() error TearDown() error // document and folder GetDocument(string, string, log.Fields) (*common.Document, error) SetDocument(string, string, *common.Document, log.Fields) error GetFolder(string, log.Fields) (*common.Folder, error) DeleteDocument(string, string, log.Fields) error DeleteFullDocument(string, log.Fields) error // root document GetRootDocument(string) (*common.RootDocument, error) SetRootDocumentVersion(string, string) error SetRootDocumentBitmap(string, int) error DeleteRootDocument(string) error DeleteRootDocumentVersion(string) error // not found IsDbNotFound(error) bool }
type SqliteClient ¶
func NewSqliteClient ¶
func NewSqliteClient(conf *configuration.Config, testOnly bool) (*SqliteClient, error)
func (*SqliteClient) DeleteDocument ¶
func (*SqliteClient) DeleteFullDocument ¶
func (c *SqliteClient) DeleteFullDocument(cpeMac string, fields log.Fields) error
func (*SqliteClient) DeleteRootDocument ¶
func (c *SqliteClient) DeleteRootDocument(cpeMac string) error
func (*SqliteClient) DeleteRootDocumentVersion ¶
func (c *SqliteClient) DeleteRootDocumentVersion(cpeMac string) error
func (*SqliteClient) GetDocument ¶
func (*SqliteClient) GetRootDocument ¶
func (c *SqliteClient) GetRootDocument(cpeMac string) (*common.RootDocument, error)
func (*SqliteClient) IsDbNotFound ¶
func (c *SqliteClient) IsDbNotFound(err error) bool
func (*SqliteClient) SetDocument ¶
func (*SqliteClient) SetRootDocumentBitmap ¶
func (c *SqliteClient) SetRootDocumentBitmap(cpeMac string, bitmap int) error
func (*SqliteClient) SetRootDocumentVersion ¶
func (c *SqliteClient) SetRootDocumentVersion(cpeMac string, version string) error
func (*SqliteClient) SetUp ¶
func (c *SqliteClient) SetUp() error
func (*SqliteClient) TearDown ¶
func (c *SqliteClient) TearDown() error